Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Jonathan Slavin <jslavin@cf...>  20100111 21:31:07

Is there any way to simply make a contour plot with logarithmic axes using matplotlib? I found a workaround by plotting log10(x), log10(y), but it'd be nicer if it was more direct. As someone new to matplotlib (experienced in IDL) I'm finding much to like, but some things are more difficult for no clear reason. It would seem to me that whether the axes are logarithmic or not would be a nice thing to have as an attribute of the plot object. I'm not familiar yet with the matplotlib internals to know how difficult that would be to implement, but it sure would be convenient. Jon Slavin 
From: JaeJoon Lee <lee.j.joon@gm...>  20100111 22:29:33

Contour will work as expected if the axes is in log scale. See below. z = np.arange(100).reshape((10,10)) x = np.logspace(0, 4, 10) y = np.logspace(0, 4, 10) ax1 = subplot(121) ax1.contour(np.log10(x), np.log10(y), z) ax2 = subplot(122) ax2.set_xscale("log") ax2.set_yscale("log") ax2.contour(x, y, z) Regards, JJ p.s. good to see another astronomer begin to use matplotlib. On Mon, Jan 11, 2010 at 3:33 PM, Jonathan Slavin <jslavin@...> wrote: > Is there any way to simply make a contour plot with logarithmic axes > using matplotlib? I found a workaround by plotting log10(x), log10(y), > but it'd be nicer if it was more direct. > > As someone new to matplotlib (experienced in IDL) I'm finding much to > like, but some things are more difficult for no clear reason. It would > seem to me that whether the axes are logarithmic or not would be a nice > thing to have as an attribute of the plot object. I'm not familiar yet > with the matplotlib internals to know how difficult that would be to > implement, but it sure would be convenient. > > Jon Slavin > > >  > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's bestinclass app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizondev2dev > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > 
From: Eric Firing <efiring@ha...>  20100111 23:51:15

JaeJoon Lee wrote: > Contour will work as expected if the axes is in log scale. See below. > > z = np.arange(100).reshape((10,10)) > x = np.logspace(0, 4, 10) > y = np.logspace(0, 4, 10) > > ax1 = subplot(121) > ax1.contour(np.log10(x), np.log10(y), z) > > ax2 = subplot(122) > ax2.set_xscale("log") > ax2.set_yscale("log") > ax2.contour(x, y, z) JJ, Actually, I think your example illustrates that there is a problem with the second approachthe first subplot generates straight lines, the second does not. The contour calculation itself really needs to be done in coordinates that are linear as displayed, because the contour locations are determined by linear interpolation. Adding support for log scales to make contour work right in your second example would be easy; making it work with more general transforms, and making it work when the transform changes after the call to contour, would be harder. I will have to look into this. Eric > > Regards, > > JJ > > p.s. good to see another astronomer begin to use matplotlib. > > > On Mon, Jan 11, 2010 at 3:33 PM, Jonathan Slavin > <jslavin@...> wrote: >> Is there any way to simply make a contour plot with logarithmic axes >> using matplotlib? I found a workaround by plotting log10(x), log10(y), >> but it'd be nicer if it was more direct. >> >> As someone new to matplotlib (experienced in IDL) I'm finding much to >> like, but some things are more difficult for no clear reason. It would >> seem to me that whether the axes are logarithmic or not would be a nice >> thing to have as an attribute of the plot object. I'm not familiar yet >> with the matplotlib internals to know how difficult that would be to >> implement, but it sure would be convenient. >> >> Jon Slavin >> >> >>  >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's bestinclass app development support >> A streamlined, 14 day to market process makes app distribution fast and easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizondev2dev >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> > >  > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's bestinclass app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizondev2dev > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers 
Sign up for the SourceForge newsletter:
No, thanks