Hi Jason, Hi list,
First of all let me say I like the EngFormatter of Jason.
Are there plans to incorparate it into matplotlib?
I cannot find any indication for this in current svn, but I would like to see
the EngFormatter in matplotlib. Therefore I tried to include Jasons proposal
into the ticker.py as a new class EngFormatter including the
I made some changes, which might break some of Jasons ideas, but I cannot see
(1) why we need the LogFormatter as base class instead of Formatter?
(2) why one should decide for only decade-labels. Therefore I removed the
corresponding if-statement. It causes errors () if you use an axes
including '0', which could be useful for eng-formatting, too.
(3) Could we always use format_str = "%g %s" instead of
specifying 'places'? Because of successive zomming I don't want to
specify 'places' before calling 'plt.show'. Therefore I introduced "places
=None" to use "%g %s".
I attached the new ticker.py and a diff against current svn (I'm sorry I
couldn't resist to add some white spaces).
Any comments are welcome.
ticker_EngFormatter.patch (5.51 KB)
ticker.py (42.9 KB)
On Wednesday 25 November 2009 01:39:43 Jason Heeris wrote:
2009/11/18 Jason Heeris <jason.heeris@...287...>:
> In gnuplot, I can do the following:
> set format x "%.0s %cHz"
> ...and this will set the x-axis labels (on a semilogx style plot) to
> be "10 Hz", "100 Hz", "1 kHz", "10 kHz", etc.
I ended up implementing this myself, it wasn't too hard. I've attached
the code if anyone else is interested. I don't know matplotlib that
well, so I don't know if there's much duplication of code in there.
I thought I'd CC the dev list in case others think it might be useful.
If not, sorry for the noise.