On Thu, Sep 23, 2010 at 3:49 AM, Oz Nahum <nahu...@gmail.com> wrote:
> Hi Everyone,
>
> I don't like the default scientific formatting in matplotlib, IMHO the
> format of having a zero after the exponent is a waste of space in my opinion
> ...
> What I mean is that mpl is writing zero as:
> 0.0e+00 or 1.2e-03. IMHO it would suffice just to do 0.0 and 1.2e-3, which
> take less space and looks better (again, imho).

<SNIP>

>
> As can be seen, the text string is empty before calling show, which is
> forcing me to show the image . Is there a way to access these labales with
> out calling show() ?

What you want is to set a custom formatter:

http://matplotlib.sourceforge.net/api/ticker_api.html

import matplotlib.pyplot as plt
f = plt.figure()
ax = f.add_subplot(111)
ax.plot([1,2,3,4,5])
# Formats ticks on the xaxis with the %.2g format string
ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.2g'))
plt.show()

If you can't get what you want using a format string, you can write a
function that does what you want can create a formatter from that
using FuncFormatter.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to