From: Jeremy C. <jer...@gm...> - 2008-09-12 20:16:56
|
First question:I know I can do pylab.loglog() to get a log-log plot. I would like to create a log-linear plot. How can I do this? Second question: I would like to plot two sequences on the same figure with two different y-scales, one scale shown on the left and one scale shown on the right. How can I do this? Thanks in advance, Jeremy |
From: Jeff W. <js...@fa...> - 2008-09-12 20:31:13
|
Jeremy Conlin wrote: > First question: > I know I can do pylab.loglog() to get a log-log plot. I would like to > create a log-linear plot. How can I do this? semilogx or semilogy: semilogy <http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-semilogy>(*args, **kwargs) Make a plot with log scaling on the *y* axis. > > Second question: > I would like to plot two sequences on the same figure with two > different y-scales, one scale shown on the left and one scale shown on > the right. How can I do this? twiny: ax = twiny <http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes-twiny>() create a twin of Axes <http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes> for generating a plot with a shared y-axis but independent x axis. The x-axis of self will have ticks on bottom and the returned axes will have ticks on the top -Jeff > > Thanks in advance, > Jeremy > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > 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 > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: Jeremy C. <jer...@gm...> - 2008-09-13 03:58:24
|
On Fri, Sep 12, 2008 at 4:31 PM, Jeff Whitaker <js...@fa...> wrote: > Jeremy Conlin wrote: > >> First question: >> I know I can do pylab.loglog() to get a log-log plot. I would like to >> create a log-linear plot. How can I do this? >> > > semilogx or semilogy: > > > > semilogy < > http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-semilogy>(*args, > **kwargs) > > Make a plot with log scaling on the *y* axis. > >> >> Second question: >> I would like to plot two sequences on the same figure with two different >> y-scales, one scale shown on the left and one scale shown on the right. How >> can I do this? >> > > twiny: > > > ax = twiny > <http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes-twiny>() > create a twin of Axes > <http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes> for > generating a plot with a shared > y-axis but independent x axis. The x-axis of self will have > ticks on bottom and the returned axes will have ticks on the > top > > -Jeff > >> Thanks for that information, that is what I needed. But now I come up with a separate problem. I have the following in my code: pylab.plot(n, S, 'b.', label='x') pylab.legend() ax2 = pylab.twinx() pylab.plot(n, mean, 'r',label="mean") ax2.yaxis.tick_right() pylab.legend() Both plots are shown with the appropriate axes, but only the second plot is listed in the legend. If I only have the first, then only the first plot will be listed. Please help. Jeremy |
From: Jeff W. <js...@fa...> - 2008-09-13 12:50:44
|
Jeremy Conlin wrote: > > > On Fri, Sep 12, 2008 at 4:31 PM, Jeff Whitaker <js...@fa... > <mailto:js...@fa...>> wrote: > > Jeremy Conlin wrote: > > First question: > I know I can do pylab.loglog() to get a log-log plot. I would > like to create a log-linear plot. How can I do this? > > > semilogx or semilogy: > > > > semilogy > <http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-semilogy>(*args, > **kwargs) > > Make a plot with log scaling on the *y* axis. > > > Second question: > I would like to plot two sequences on the same figure with two > different y-scales, one scale shown on the left and one scale > shown on the right. How can I do this? > > > twiny: > > > ax = twiny > > <http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes-twiny>() > create a twin of Axes > <http://matplotlib.sourceforge.net/matplotlib.axes.html#Axes> > for generating a plot with a shared > y-axis but independent x axis. The x-axis of self will have > ticks on bottom and the returned axes will have ticks on the > top > > -Jeff > > > Thanks for that information, that is what I needed. But now I come up > with a separate problem. I have the following in my code: > > pylab.plot(n, S, 'b.', label='x') > pylab.legend() > ax2 = pylab.twinx() > pylab.plot(n, mean, 'r',label="mean") > ax2.yaxis.tick_right() > pylab.legend() > > Both plots are shown with the appropriate axes, but only the second > plot is listed in the legend. If I only have the first, then only the > first plot will be listed. Please help. > > Jeremy Jeremy: The problem is that the legends are plotting on top of each other. Try using 'loc=1' for the first one and 'loc=2' for the second one. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 |
From: John O. <joh...@ya...> - 2008-11-24 02:46:05
|
Jeff Whitaker wrote: > > Jeremy Conlin wrote: >> >> >> Thanks for that information, that is what I needed. But now I come up >> with a separate problem. I have the following in my code: >> >> pylab.plot(n, S, 'b.', label='x') >> pylab.legend() >> ax2 = pylab.twinx() >> pylab.plot(n, mean, 'r',label="mean") >> ax2.yaxis.tick_right() >> pylab.legend() >> >> Both plots are shown with the appropriate axes, but only the second >> plot is listed in the legend. If I only have the first, then only the >> first plot will be listed. Please help. >> >> Jeremy > Jeremy: The problem is that the legends are plotting on top of each > other. Try using 'loc=1' for the first one and 'loc=2' for the second > one. > What if I wanted one legend with both entries in it, rather than two separate legends with a different entry in each? Is that possible? That's more desirable than two separate legends. JDO -- View this message in context: http://www.nabble.com/Two-questions-regarding-axis-scaling-tp19463338p20654006.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Jae-Joon L. <lee...@gm...> - 2008-11-24 06:01:48
|
> > What if I wanted one legend with both entries in it, rather than two > separate legends with a different entry in each? Is that possible? That's > more desirable than two separate legends. > Check http://www.nabble.com/displaying-a-legend-from-a-different-subplot-td18447966.html#a18447966 The legend() function lets you explicitly set what items you want to show, regardless which axes they are from. -JJ |