From: Fernando P. <Fer...@co...> - 2005-02-04 19:06:33
|
John Hunter wrote: > If you have data points really close to 0, eg > > 1 >>> x = arange(-2.00, 10, 0.01) > > 2 >>> amin(abs(x)) > Out[2]: 4.163336342344337e-17 > > You may a heavy performance price because so many decades are plotted, > each with minor ticks, and ticks are expensive in the current impl. I had a look at gnuplot's strategy: planck[~]> npy In [1]: x = frange(1e-40, 10, npts=1003) In [2]: gp('set logscale y') In [3]: plot x,filename='logplotex.eps' The result is here: http://amath.colorado.edu/faculty/fperez/tmp/logplotex.eps They seem to plot a maximum of 11 major ticks (that's what I'm guessing from a bunch of tests). When it fits, each major tick is a decade, but at some point their algorithm switches over (like in my example) to every 3rd, 5th, whatever-th decade, and the minor ticks become decade ticks themselves. When this happens, there are no logarithmically spaced ticks any more, obviously. This is overall a nice approach, I think. I have quite a few plots which cover 30 decades, and in matplotlib the result looks very crowded, while gnuplot's enforcement of a max of 11 (or whatever) major ticks gives a clean looking plot. Gnuplot has many problems (hence my switch -finally- to mpl), but it has over a decade of fine-tuning of its behavior and interface, so it's not a bad source of inspiration. It is mature and robust, and many of the things it does, it does really well. I'll keep bringing up areas where I feel we can benefit from it (I know it reasonably well) as I move all my code over to mpl. Cheers, f |