From: Elizabeth Harper-C. <h-...@ci...> - 2011-04-04 21:50:11
|
Hello, I've been playing with the script and I now know a little bit more about what is wrong. I can get the full graph space to plot by changing: ax_mass = SubplotHost(fig, 1,1,1, aspect=1.) to ax_mass = SubplotHost(fig, 1,1,1) but then a line is never drawn. I have removed the x and y axis limits and it plots the axes for the limits of the date but no line for the graph? Here is the relevant part of the code: fig = plt.figure() ax_mass = SubplotHost(fig, 1,1,1) frac_to_mass = gasmass print 'frac_to_mass', frac_to_mass aux_trans = mtransforms.Affine2D().scale(1., frac_to_mass) ax_frac = ax_mass.twin(aux_trans) ax_frac.set_viewlim_mode("transform") fig.add_subplot(ax_mass) ax_mass.plot(time,massesMsun, linestyle='-', color='k', linewidth=2.0) ax_mass.axis["bottom"].set_label("Time (Myrs)" ) ax_frac.axis["right"].set_label("Fraction of Original Gas Mass in Stars" ) ax_mass.axis["left"].set_label("Mass in Stars (Msun)" ) ax_frac.axis["right"].major_ticklabels.set_visible(True) ax_frac.axis["top"].major_ticklabels.set_visible(False) plt.savefig(frame_template %(folder,name[0],name[int(sys.argv[1])-1]), format="eps") can I not use ax_mass.plot? Thanks, Libby On 4 April 2011 17:00, Elizabeth Harper-Clark <h-...@ci...>wrote: > Hi guys, > > I am trying to use the Axes grid toolkit to plot a graph with a second y > axes that gives the first y axes in different units (similar to > http://matplotlib.sourceforge.net/examples/axes_grid/parasite_simple2.html?highlight=subplothost). > I am clearly getting something wrong or missing something as I get both y > axes but no graph inbetween. Plot and script attached. Please can anyone see > what I have got wrong or point me in the direction of more extensive > documentation about parasite axes or SubplotHost? > > Many thanks, > > Libby > > > -- > Elizabeth Harper-Clark MA MSci > PhD Candidate, Astrophysics, UofT > > > www.astro.utoronto.ca/~h-clark <http://www.astro.utoronto.ca/%7Eh-clark> > h-...@ci... > AIM: edphc1 > MSN: ed...@ho... > Skype: eharperclark > Office phone: 416-978-5759 > -- Elizabeth Harper-Clark MA MSci PhD Candidate, Astrophysics, UofT www.astro.utoronto.ca/~h-clark <http://www.astro.utoronto.ca/%7Eh-clark> h-...@ci... AIM: edphc1 MSN: ed...@ho... Skype: eharperclark Office phone: 416-978-5759 |