Re: [Matplotlib-users] one data set, two y axis scales

2009-06-04 Thread Sandro Tosi
Hi, On Thu, Jun 4, 2009 at 06:56, musik wrote: > I want to make a plot with both y axes labeled. The one on the left (y1) > will be in Fahrenheit,  while the one on the right (y2) in Celsius. Is there > a way to do this? what you're looking for is [1] [1] http://matplotlib.sourceforge.net/api/

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-04 Thread Ryan May
On Thu, Jun 4, 2009 at 6:01 AM, Sandro Tosi wrote: > Hi, > > On Thu, Jun 4, 2009 at 06:56, musik wrote: > > I want to make a plot with both y axes labeled. The one on the left (y1) > > will be in Fahrenheit, while the one on the right (y2) in Celsius. Is > there > > a way to do this? > > what y

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-04 Thread musik
Exactly. I want to plot the original data once, but the two y axes show different scales (units). Is twinx() good for that? How? Thanks. Ryan May-3 wrote: > > On Thu, Jun 4, 2009 at 6:01 AM, Sandro Tosi wrote: > >> Hi, >> >> On Thu, Jun 4, 2009 at 06:56, musik wrote: >> > I want to make a

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-04 Thread Ryan May
On Thu, Jun 4, 2009 at 10:08 AM, musik wrote: > > Exactly. I want to plot the original data once, but the two y axes show > different scales (units). Is twinx() good for that? How? > I wouldn't call it "good", but you can make it work. Basically, you'd plot your data once in F, then convert it

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-04 Thread Jae-Joon Lee
I hope the code below gives you some idea. def Tc(Tf): return (5./9.)*(Tf-32) ax1 = subplot(111) # y-axis in F ax2 = twinx() # y-axis in C def update_ax2(ax1): y1, y2 = ax1.get_ylim() ax2.set_ylim(Tc(y1), Tc(y2)) # automatically update ylim of ax2 when ylim of ax1 changes. ax1.callback

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-04 Thread Ryan May
On Thu, Jun 4, 2009 at 12:16 PM, Jae-Joon Lee wrote: > I hope the code below gives you some idea. > > > def Tc(Tf): return (5./9.)*(Tf-32) > > ax1 = subplot(111) # y-axis in F > ax2 = twinx() # y-axis in C > > def update_ax2(ax1): >y1, y2 = ax1.get_ylim() >ax2.set_ylim(Tc(y1), Tc(y2)) > >

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-04 Thread musik
This works nicely. Thank you JJ. Jae-Joon Lee wrote: > > I hope the code below gives you some idea. > > > def Tc(Tf): return (5./9.)*(Tf-32) > > ax1 = subplot(111) # y-axis in F > ax2 = twinx() # y-axis in C > > def update_ax2(ax1): > y1, y2 = ax1.get_ylim() > ax2.set_ylim(Tc(y1),

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-05 Thread John Hunter
On Thu, Jun 4, 2009 at 12:16 PM, Jae-Joon Lee wrote: > I hope the code below gives you some idea. > > > def Tc(Tf): return (5./9.)*(Tf-32) > > ax1 = subplot(111) # y-axis in F > ax2 = twinx() # y-axis in C > > def update_ax2(ax1): >y1, y2 = ax1.get_ylim() >ax2.set_ylim(Tc(y1), Tc(y2)) > > #

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-05 Thread Andrew Straw
John Hunter wrote: > On Thu, Jun 4, 2009 at 12:16 PM, Jae-Joon Lee wrote: >> I hope the code below gives you some idea. >> >> >> def Tc(Tf): return (5./9.)*(Tf-32) >> >> ax1 = subplot(111) # y-axis in F >> ax2 = twinx() # y-axis in C >> >> def update_ax2(ax1): >>y1, y2 = ax1.get_ylim() >>ax

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-05 Thread John Hunter
On Fri, Jun 5, 2009 at 11:44 AM, Andrew Straw wrote: > I think this would be a good direction, as well. It would also allow > disabling the tick mark labels in some axes that share the same axis -- > because the ticks/labels would belong to the spine, which itself > wouldn't (necessarily) be share

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-05 Thread Jae-Joon Lee
John, These ideas have been part of motivation behind my axes_grid toolkit. In the module documentation of "lib/mpl_toolkits/axes_grid/axislines.py", I tried to briefly explain what I wanted and what I implemented, although the explanation is very far from complete (also some examples are found in

Re: [Matplotlib-users] one data set, two y axis scales

2009-06-06 Thread Sebastian Busch
Jae-Joon Lee wrote: > ... > def Tc(Tf): return (5./9.)*(Tf-32) > > ax1 = subplot(111) # y-axis in F > ax2 = twinx() # y-axis in C > > def update_ax2(ax1): > y1, y2 = ax1.get_ylim() > ax2.set_ylim(Tc(y1), Tc(y2)) > > # automatically update ylim of ax2 when ylim of ax1 changes. > ax1.callb