|
From: Fernando P. <Fer...@co...> - 2005-02-04 21:19:33
|
John Hunter wrote:
> I just committed some changes to CVS for auto-log scaling of line
> plots - you pay a performance hit for log plots but it appears to
> work. Eg, you can do
>
> x = arange(-2.002, 10, 0.01)
> y = sin(2*pi*x)
> plot(x,y)
> set(gca(), xscale='log')
>
> and only the positive data are plotted.
OK, with ssh CVS this works quite well. If you try the same with
set(gca(), yscale='log')
you'll see a funky junction. I think here gnuplot can again give us some
guidance for good bailout behaviour:
http://amath.colorado.edu/faculty/fperez/tmp/log-sin.ps
I think this is a reasonable approach.
Now, there is something funky though in semilogy:
In [13]: plot(frange(.1,1,npts=20),frange(0.1,1,npts=20))
Out[13]: [<matplotlib.lines.Line2D instance at 0x40f631ac>]
In [14]: set(gca(), yscale='log')
Out[14]: [None]
Works perfectly. Yet:
In [15]: close('all')
In [16]: semilogy(frange(.1,1,npts=20),frange(0.1,1,npts=20))
ERROR: min() or max() arg is an empty sequence
I'd expect these two to be identical, no? Perhaps you just haven't had the
time to track down all the places where this needs to be applied.
At any rate, this is a huge improvement for log plots (which I happen to use
every day). You've pretty much bought yourself the %run backend work, and at
least a stab at the gtk stuff for ipython :)
Best,
f
ps. Now that I'm good with ssh CVS, let me know if you finish polishing this
up, and I can test it quickly and report back. I have a ton of pretty
stressful log plots I can throw at it.
|