Hello all,
   I have been making some big multiplots lately and found a nice little
way of writing out 30 plots as follows, this part works great and leads up
to my question, here I have 30 sets defined by the set=(), in this case I
get a nice arrangement of 30 plots for V(GSR) and Log(g) (2 variables):
-----------------------------------------
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
        ax.plot(VGSR[set],logg[set],'.b')

#label the axis
        if index==13.0:
            ax.set_ylabel('counts')
        if index >= 25.0:
            ax.set_xlabel('VGSR')
plt.show()

However, if I want a histogram plot instead, I get my histogram only on the
last i.e. set(dat['a30']==1) plot, so instead of 30 nice plots I get 29
empty ones and one crowded plot with some number of histograms in it.  The
set is the same, the data is the same, the only difference is the
histogram, the code also looks pretty much the same, it is:
#----------------------------------------------
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
        P.hist(VGSR[set],bins=30, normed=True)

#label the axis
        if index==13.0:
            ax.set_ylabel('counts')
        if index >= 25.0:
            ax.set_xlabel('VGSR')
plt.show()
#-----------------------------------------------
Here I use import pylab as P and import matplotlib.pyplot as plt

Any ideas would be appreciated, thanks in advance!
~Elaina

-- 
PhD Candidate
Department of Physics and Astronomy
Faculty of Science
Macquarie University
North Ryde, NSW 2109, Australia
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to