On Wed, Oct 22, 2008 at 7:27 AM, Jeffrey Fogel <[EMAIL PROTECTED]> wrote: > I've having a problem creating multiple x-axis and I'm hoping someone > here will be able to help me. I have two directly correlated values > (z and N) that I am using as the independent variables. What I would > like to do is plot my data vs. N, but then show the corresponding z > values on the top axis (there is a 1-to-1 correspondence between every > z and N value). I have tried twiny, but this requires me to plot the > line again and, since the z and N values are scaled differently, I end > up with 2 lines that don't match up. >
Hi Jeffrey, Are you adverse to drawing two lines? If you use the 'twiny' approach, you can simply manually set the top-axis limits to correspond to what you need: In [2]: plot([1,2,3], [4,5,6]) Out[2]: [<matplotlib.lines.Line2D instance at 0x91abd8>] In [3]: ax1 = gca() In [4]: ax2 = gcf().add_axes(ax1.get_position(), sharey=ax1, frameon=False) In [5]: ax2.xaxis.tick_top() In [6]: plot([1.3, 2.6, 3.9],[4,5,6]) Out[6]: [<matplotlib.lines.Line2D instance at 0x1b76ab8>] In [7]: ax2.set_xlim([1.3,3.9]) Out[7]: (1.3, 3.8999999999999999) In [8]: draw() Cheers, A> ------------------------------------------------------------------------- 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-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users