[Tutor] Looping over histogram plots
Elaina Ann Hyde
elainahyde at gmail.com
Wed Jun 27 03:44:36 CEST 2012
Yay Python:
The solution was a syntax one, if anyone else ever feels like massively
multi-plotting histograms, here is the working code:
#----------------------------------------------
fig, axes = plt.subplots(nrows=5, ncols=6, figsize=(12,6))
index=0
for b in axes:
for ax in b:
index=index+1
set=(dat['a'+str(index)] == 1.00)
#write the data
n, bins, patches = ax.hist(VGSR[set], 30, normed=1)
#label the axis
if index==13.0:
ax.set_ylabel('counts')
if index >= 25.0:
ax.set_xlabel('VGSR')
plt.show()
#-----------------------------------------------
~Elaina Hyde
--
PhD Candidate
Department of Physics and Astronomy
Faculty of Science
Macquarie University
North Ryde, NSW 2109, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120627/1634274c/attachment.html>
More information about the Tutor
mailing list