Re: [Matplotlib-users] where is twiny ??
On 2/13/07, Eric Emsellem [EMAIL PROTECTED] wrote: Hi, I would need the equivalent of twinx, but for other axis, so a twiny function. Shouldn't it be in mpl already? thanks for your help, At the time noone wanted it, but it's easy enough to do. I just added the following to pylab svn: def twiny(ax=None): Make a second axes overlay ax (or the current axes if ax is None) sharing the yaxis. The ticks for ax2 will be placed on the top, and the ax2 instance is returned. if ax is None: ax=gca() ax2 = gcf().add_axes(ax.get_position(), sharey=ax, frameon=False) ax2.xaxis.tick_top() ax2.xaxis.set_label_position('top') ax.xaxis.tick_bottom() draw_if_interactive() return ax2 - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] where is twiny ??
On Tue, 13 Feb 2007, Eric Emsellem wrote: I would need the equivalent of twinx, but for other axis, so a twiny function. Shouldn't it be in mpl already? twiny() doesn't exist, but the source code of twinx() is in lib/matplotlib/pylab.py and it's about eight lines long, so it's easy enough to duplicate it, changing right to top, left to bottom, etc. See for example http://www.nabble.com/How-can-I-avoid-sharey-tick-ovelap--t2700831.html The one catch with this, practically, is that the top x axis is written in the same place as the plot title. I have yet to play with the placement of the title. == Office: 0.17 (Golm) Dr. John T. Whelan Phone: +49 331 567 7117 Albert-Einstein Institute FAX: +49 331 567 7298 Am Muehlenberg 1 http://www.aei.mpg.de/~whelan/ D-14476 Potsdam [EMAIL PROTECTED][EMAIL PROTECTED] == - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] where is twiny ??
On 2/13/07, John T Whelan [EMAIL PROTECTED] wrote: The one catch with this, practically, is that the top x axis is written in the same place as the plot title. I have yet to play with the placement of the title. A combination of moving the stop of the subplot down with the subplots_adjust function and moving the title up by increasing the y value (1 is the top of the axes) should do it In [39]: fig = figure() In [40]: subplots_adjust(top=0.8) In [41]: ax1 = subplot(111) In [42]: ax2 = twiny(ax1) In [43]: ax1.plot(rand(100), rand(100), 'bo') Out[43]: [matplotlib.lines.Line2D instance at 0x93e8e8c] In [44]: ax2.plot(20*rand(100), rand(100), 'rs') In [45]: ax1.set_title('this is a test', y=1.1) Out[45]: matplotlib.text.Text instance at 0x8e1c0ec - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users