contour plot axis labels

Hi,

when I create a contour plot with the following grid:
   xval = [ 1.00003324, 1.00009971, 1.00016618]
   yval = [250, 260, 270]
   data = ones((3,3))
   contourf(xval, yval, data)

matplotlib creates a contour plot with an x-axes labels of "0.0000324", ... and adds a "+1" in the lower right corner.
Actually, it is often not visible at all.

How can I set it to always use the "correct" values directly as labels?

Greetings,
Jochen

···

--
Fritz-Haber-Institut der MPG -- Department of Molecular Physics
Faradayweg 4-6 (C1.03)
D-14195 Berlin, Germany

phone: +49-30-84135686
fax: +49-30-84135892
http://www.fhi-berlin.mpg.de/mp/jochen

Jochen K�pper wrote:

Hi,

when I create a contour plot with the following grid:
   xval = [ 1.00003324, 1.00009971, 1.00016618]
   yval = [250, 260, 270]
   data = ones((3,3))
   contourf(xval, yval, data)

matplotlib creates a contour plot with an x-axes labels of "0.0000324", ... and adds a "+1" in the lower right corner.
Actually, it is often not visible at all.

How can I set it to always use the "correct" values directly as labels?

Greetings,
Jochen

Hi, you can use

gca().xaxis.set_major_formatter(ScalarFormatter(useOffset=False))

see also examples/newscalarformatter_demo.py

Manuel

That works perfectly!

As a more general question: How was I supposed to find this out? What user-documentation is there besides the matplotlib.sf.net homepage and the PDF user guide? Should I have found it in these docs already?

Thanks for your help.

Greetings,
Jochen

···

On 08.04.2008, at 19:51, Manuel Metz wrote:

Jochen Küpper wrote:

matplotlib creates a contour plot with an x-axes labels of "0.0000324", ... and adds a "+1" in the lower right corner.
Actually, it is often not visible at all.
How can I set it to always use the "correct" values directly as labels?

gca().xaxis.set_major_formatter(ScalarFormatter(useOffset=False))

see also examples/newscalarformatter_demo.py

--
Einigkeit und Recht und Freiheit http://www.Jochen-Kuepper.de
     Liberté, Égalité, Fraternité GnuPG key: CC1B0B4D
         Sex, drugs and rock-n-roll