Hello y'all: I am trying to plot a fig with three subplots. However when I run my script the subplots are all shifted way too high (http://img.skitch.com/20090720-fp462u8ww4bq38j29u9bjtr2cx.png) and the top subplot is cut off.
I tried doing something like this from reading another poster's thread but this did absolutely nothing: mpl.figure.SubplotParams(left= (48 / 72.0) / figW, # 48-point left margin bottom= (36 / 72.0) / figH, # etc. right= 1 - (18 / 72.0) / figW, top= 1 - (12 / 72.0) / figH) Anyone have an idea how to fix this. Thank you for your time. Gus The code is below for those interested: <code> supTitle = 'Ortholog Pairs Matching "Real" or "Control" Ag miRNA seeds.' data = [] for dFile in iFiles: data.append(pickle.load(open(dFile,'rU'))) ks = [] for i in range(len(data)): ks.append(sorted(data[i].keys())) for i in range(len(ks)): if "!doc" in ks[i]: ks[i].pop(0) # if the pkl has a !doc entry. pop it assert odd_or_even(len(ks[i])) == 'even', 'Error: len(ks[i]) must be even.' pos1Data = eval('[%s]' % ('[],'*len(data))) pos1Keys = eval('[%s]' % ('[],'*len(data))) pos2Data = eval('[%s]' % ('[],'*len(data))) pos2Keys = eval('[%s]' % ('[],'*len(data))) for i in range(len(ks)): for j in range(len(ks[i])): if odd_or_even(j) == 'even': # remember that we start with 0 which is even. pos1Data[i].append(data[i][ks[i][j]]) pos1Keys[i].append(ks[i][j]) else: pos2Data[i].append(data[i][ks[i][j]]) pos2Keys[i].append(ks[i][j]) figW = 16 figH = 8 plt.figure(num=None, figsize=None, dpi=None, facecolor='w', edgecolor='k') subplotpars=mpl.figure.SubplotParams(left= (48 / 72.0) / figW, # 48-point left margin bottom= (36 / 72.0) / figH, # etc. right= 1 - (18 / 72.0) / figW, top= 1 - (12 / 72.0) / figH) plt.suptitle(supTitle) for i in range(len(data)): matches1 = [x[0] for x in pos1Data[i]] ctrls1 = [-x[1] for x in pos1Data[i]] matches2 = [x[0] for x in pos2Data[i]] ctrls2 = [-x[1] for x in pos2Data[i]] assert len(matches1) == len(matches2), 'Error: matches1 and matches 2 do not have the same number of elements!' N = len(matches1) ind = np.arange(N) # the x locations for the groups width = 0.35 # the width of the bars: can also be len(x) sequence plt.subplot(len(data),1,i,) p1 = plt.bar(ind, ctrls1, width, color='w',) p2 = plt.bar(ind, matches1, width, color='b',) p3 = plt.bar(ind+width, ctrls2, width, color='w',) p4 = plt.bar(ind+width, matches2, width, color='b', ) plt.ylabel(subTitles[i]) if i == len(data)-1: plt.xlabel('miRNA seed') axMax = max(matches1+matches2)*1.1 axMin = min(ctrls1+ctrls2)*1.1 #plt.axis([0,len(matches1),axMin,axMax]) if i == 0: plt.legend( (p2[0], p1[0]), ('Real', 'Ctrls'), loc=(1.01,0.65) ) </code> ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users