Hi, Sorry I didn't respond to this immediately - I have had my mind on other things. plotyy is basically a wrapper around twinx that provides a bit of extra/built-in functionality. The idea is that you have two curves with similar x values, but different y that you want to plot together. It plots them both using twinx, but to help with visualisation, it changes the color of each curve and associated axis so that they are easy to distinguish (e.g., left blue, right green). This is also similar to a matlab function of the same name, so it helps us matlab converts out.
An example of using this function might be: x = linspace(0,pi,20) y = sin(x) x2 = linspace(0.1,pi-0.1,20) y2 = cos(x2) axs,h1,h2=plotyy(x,y,x2,y2) axs is a list with [ax1,ax2]. As is evident from the code itself, there isn't too much beyond what twinx already does, but this code aids matlab compatibility and also the recursive handle property change is useful. But this recursive code could be extricated to provide a general setp_recursive function that would change a property on an object and all its children (that have that property) if that is of interest. Cheers, David On Fri, 2008-07-25 at 15:00 -0400, Ryan May wrote: > David Kaplan wrote: > > The second patch is to pyplot.py to create a plotyy function. This is > > like a matlab function of the same name that puts two curves with > > different y ranges on the same x axis. It basically wraps the > > two_scales.py demo functionality with a bit of extra stuff. I had to > > use a real hack to change the colors of the y axes. Perhaps someone can > > think of a better way or perhaps this sub-function should be moved out > > of plotyy so it can be reused. Also, I couldn't find a way to color the > > actual y-axis - i.e. the vertical line that is the y-axis. Is there an > > easy way to do this? > > Do you have an example of how to use this (or at least what the results > look like)? I'm having trouble seeing how this differs from twinx. > > Ryan > -- ********************************** David M. Kaplan Charge de Recherche 1 Institut de Recherche pour le Developpement Centre de Recherche Halieutique Mediterraneenne et Tropicale av. Jean Monnet B.P. 171 34203 Sete cedex France Phone: +33 (0)4 99 57 32 27 Fax: +33 (0)4 99 57 32 95 http://www.ur097.ird.fr/team/dkaplan/index.html ********************************** ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel