On Tue, Jan 18, 2011 at 2:52 AM, <g.plantagen...@runbox.com> wrote: > Hi, > > I have a problem with plotting two different quantities on the same plot > (overlaying two different axes). > I plot two different quantities, with different scales, on two overlapping > axes. So, I want the quantity 1 to refer to the y axis on the left (with its > ticks and labels), and quantity 2 to refer to the y axis on the right (with > its ticks and labels). I choose on which side I want the ticks with > ax.yaxis.tick_left(). Anyway, if I want then to change the label size of the > right y axis, I can't do that. I included a sample plot. > > My code is something like this: > > F = figure() > #First quantity > AX1 = F.add_axes(rect) > AX1.plot(x1,y1) > AX1.yaxis.tick_left() #with this I say quantity 1=left y axis > AX1.set_yticks(range(2,14,2)) > AX1.set_yticklabels(range(2,14,2),size=20) > #Second quantity (with different scale) > AX2 = F.add_axes(rect,frameon=False) > AX2.plot(x2,y2) > AX2.yaxis.tick_right() #If I leave this line, I can't change the tick label > size, if I remove it, I get ticks on both sides > AX2.set_yticks(np.arange(16.8,18.8,0.4)) > AX2.set_yticklabels(np.arange(16.8,18.8,0.4),size=20,position=(1.08,0))
Instead of tick_right() try: AX2.yaxis.set_ticks_position('right') Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users