Hi,
I'm not sure what I'm doing wrong here:
import matplotlib.pyplot as mpl
from matplotlib.ticker import NullFormatter
fig = mpl.figure()
ax = fig.add_subplot(111)
ax.xaxis.set_major_formatter(NullFormatter)
This returns the error:
Traceback (most recent call last):
File "test.py", line 6, in <module>
ax.xaxis.set_major_formatter(NullFormatter)
File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/axis.py", line 1091, in set_major_formatter
formatter.set_axis(self)
TypeError: unbound method set_axis() must be called with NullFormatter instance as first argument (got XAxis instance instead)
Am I using set_major_formatter wrongly?
Thanks,
Thomas
http://matplotlib.sourceforge.net/api/axis_api.html?highlight=set_major_formatter#matplotlib.axis.Axis.set_major_formatter
An instance of NullFormatter is needed, instead of the class itself.
ax.xaxis.set_major_formatter(NullFormatter())
-JJ
···
On Tue, Oct 20, 2009 at 4:43 PM, Thomas Robitaille <thomas.robitaille@...287...> wrote:
ax.xaxis.set_major_formatter(NullFormatter)
You need to use an *instance* of NullFormatter, which is the name of a
class. Try:
ax.xaxis.set_major_formatter(NullFormatter())
Ryan
···
On Tue, Oct 20, 2009 at 3:43 PM, Thomas Robitaille <thomas.robitaille@...287...> wrote:
Hi,
I'm not sure what I'm doing wrong here:
import matplotlib.pyplot as mpl
from matplotlib.ticker import NullFormatter
fig = mpl.figure()
ax = fig.add_subplot(111)
ax.xaxis.set_major_formatter(NullFormatter)
This returns the error:
Traceback (most recent call last):
File "test.py", line 6, in <module>
ax.xaxis.set_major_formatter(NullFormatter)
File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/
axis.py", line 1091, in set_major_formatter
formatter.set_axis(self)
TypeError: unbound method set_axis() must be called with NullFormatter
instance as first argument (got XAxis instance instead)
Am I using set_major_formatter wrongly?
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma