On Jan 16, 2008 1:03 PM, Kevin Christman <[EMAIL PROTECTED]> wrote:
>
> I'm new to matplotlib. Currently the x-axis shows numbers from 0 to 1.
>   I would like it to show it in percent notation (e.g. 0% to 100%).
>   How do I do this in matplotlib?

You can either multiply your x data by 100 (where x is a numpy array)

>>> plot(x*100, y)

or set a custom formatter

from matplotlib.ticker import FuncFormatter

def myfunc(x, pos=0):
    return '%1.2f''%(100*x)

ax = subplot(111)
ax.plot(x, y)
ax.xaxis.set_major_formatter(FuncFormatter(myfunc))

There is a section on custom tick formatting in the user's guide on the web site

JDH

JDH

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to