I was making subplots using the bar command and ran into a problem I do not understand.
nr = number of rows, nc = number of columns
I want nr = 1, i.e. just one row of plots. If nc is 1 or 2 all is well, but nc =3 the third plot is cutoff in the middle. If nc = 4, I get 3 plots and the fourth cannot be seen.
What seems to be happening is that the subplots are not scaled to fit the viewport dictated by suplot(nr,nc,plotNumber).
I have used nc = 3 or 4 if I use the plot command and all the plots are squished into the subregions for which I asked - even if things get ugly.
I use the PS and Agg backends and both yield similar results.
My code is below.
Thanks for any help.
from matplotlib.matlab import *
nTypes = 3
ind = arange(nTypes) # the x locations for the groups
width = .2 # the width of the bars
nr = 1
nc = 3
crap = 
for c in range(nc):
for r in range(nr):
subplotID = nc*r + c + 1
ax = subplot(nr,nc,subplotID)
frame = ax.get_frame()
amip = (20, 35, 30)
p1 = bar(ind, amip, width, color='r')
climo = (25, 32, 34)
p2 = bar(ind+width, climo, width, color='y')
isccp = (5, 10, 60)
p3 = bar(ind+2.0*width, isccp, width, color='g')
atlas = (20, 40, 70)
p4 = bar(ind+3.0*width, atlas, width, color='b')
ylabel('Cloud Fraction (%)')
title('Cloud' + str(subplotID)+'_'+str(c)+'_'+str(r) )
set(gca(), 'xticks', ind+2*width)
set(gca(), 'xticklabels', ('low', 'mid', 'high') )
set(gca(), 'yticks', arange(0,100,10))
legend( (p1, p2,p3,p4), ('Amip', 'climo','isccp','atlas') )