John Hunter wrote:
> On Thu, Jun 4, 2009 at 12:16 PM, Jae-Joon Lee<lee.j.j...@gmail.com> 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))
>>
>> # automatically update ylim of ax2 when ylim of ax1 changes.
>> ax1.callbacks.connect("ylim_changed", update_ax2)
>> ax1.plot([78, 79, 79, 77])
> 
> Yes, this is a cute little example.  I was thinking along the lines
> Ryan was, to just plot the same data twice with twinx, but this is
> cleverer.   I added it to svn as:
> examples/api/fahrenheit_celcius_scales.py
> 
> But using twinx has always been a hack.  I think what we really need
> is to have each spine have it's own locator, formatter and tick
> collection (eg the natural points for Celcius ticks are different from
> the natural points for Fahrenheit ticks) and currently the left and
> right ticks of an axis share the axis locator and formatter.
> Currently the spines just draw the lines and the axes/axis handle all
> the ticks and the locators.  It might be more natural to move these
> into the spine itself, and support independent
> ticks/locators/formatter for each spine, with the default being
> shared.
> 
> Andrew, did you give this any thought in the spine implementation?  I
> am pretty sure it would be hard, but maybe you have a better sense of
> *how hard*.  This would be a nice enhancement.

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 shared.

I can't promise anything, but this may be a solution to the issues that
Jae-Joon pointed out w.r.t loglog plots in the spine implementation
(although I suspect they are more general). I'll take a look at it,
although I can't say exactly when I'll do so -- hopefully within the
coming week.

-Andrew

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to