I have just updated to a matplotlib build from SVN, and now all my subplots generate errors: (Pdb) rows Out[3]: 2 (Pdb) columns Out[3]: 2 (Pdb) num Out[3]: 1 (Pdb) subplot(rows, columns, num) *** KeyError: 'axes.formatter.limits' I really dont know why this is happening, so I would appreciate any assistance. Thanks, Chris -- Chris Fonnesbeck + Atlanta, GA + http://trichech.us
Chris, I suspect it is a problem with your matplotlibrc file; you could try stripping it down to bare minimum, as in the svn root directory. Another possibility is that your update is somehow incomplete or scrambled with an earlier installation. If that doesn't work, try making a minimal script that illustrates the problem. examples/newscalarformatter_demo.py works fine, so I don't think the basic subplot mechanism is broken. Chris Fonnesbeck wrote: > I have just updated to a matplotlib build from SVN, and now all my > subplots generate errors: > > (Pdb) rows > Out[3]: 2 > (Pdb) columns > Out[3]: 2 > (Pdb) num > Out[3]: 1 > (Pdb) subplot(rows, columns, num) > *** KeyError: 'axes.formatter.limits' I think this is a valid key in rcParams. Doesn't the error trigger a full traceback that shows where it is coming from? Eric > > I really dont know why this is happening, so I would appreciate any > assistance. > > Thanks, > Chris > > -- > Chris Fonnesbeck + Atlanta, GA + http://trichech.us
On 1/6/07, Eric Firing <ef...@ha...> wrote: > > Chris, > > I suspect it is a problem with your matplotlibrc file; you could try > stripping it down to bare minimum, as in the svn root directory. > Another possibility is that your update is somehow incomplete or > scrambled with an earlier installation. > > If that doesn't work, try making a minimal script that illustrates the > problem. > > examples/newscalarformatter_demo.py works fine, so I don't think the > basic subplot mechanism is broken. > > > Chris Fonnesbeck wrote: > > I have just updated to a matplotlib build from SVN, and now all my > > subplots generate errors: > > > > (Pdb) rows > > Out[3]: 2 > > (Pdb) columns > > Out[3]: 2 > > (Pdb) num > > Out[3]: 1 > > (Pdb) subplot(rows, columns, num) > > *** KeyError: 'axes.formatter.limits' > > I think this is a valid key in rcParams. > > Doesn't the error trigger a full traceback that shows where it is coming > from? > > I am still getting this problem. Here is an ipython traceback of a very simple plot: In [1]: from pylab import * In [2]: plot([3,45,6],[7,9,2]) --------------------------------------------------------------------------- exceptions.KeyError Traceback (most recent call last) /Users/chris/<ipython console> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py in plot(*args, **kwargs) 2036 def plot(*args, **kwargs): 2037 # allow callers to override the hold state by passing hold=True|False -> 2038 b = ishold() 2039 h = popd(kwargs, 'hold', None) 2040 if h is not None: /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py in ishold() 935 Return the hold status of the current axes 936 """ --> 937 return gca().ishold() 938 939 def isinteractive(): /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py in gca(**kwargs) 881 """ 882 --> 883 ax = gcf().gca(**kwargs) 884 return ax 885 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/figure.py in gca(self, **kwargs) 677 ax = self._axstack() 678 if ax is not None: return ax --> 679 return self.add_subplot(111, **kwargs) 680 gca.__doc__ = dedent(gca.__doc__) % artist.kwdocd 681 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/figure.py in add_subplot(self, *args, **kwargs) 504 a = PolarSubplot(self, *args, **kwargs) 505 else: --> 506 a = Subplot(self, *args, **kwargs) 507 508 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py in __init__(self, fig, *args, **kwargs) 4909 """ 4910 SubplotBase.__init__(self, fig, *args) -> 4911 Axes.__init__(self, fig, [self.figLeft, self.figBottom, 4912 self.figW, self.figH], **kwargs) 4913 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py in __init__(self, fig, rect, axisbg, frameon, sharex, sharey, label, **kwargs) 437 438 # this call may differ for non-sep axes, eg polar --> 439 self._init_axis() 440 441 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py in _init_axis(self) 468 def _init_axis(self): 469 "move this out of __init__ because non-separable axes don't use it" --> 470 self.xaxis = XAxis(self) 471 self.yaxis = YAxis(self) 472 /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axis.py in __init__(self, axes) 512 self.minorTicks = [] 513 --> 514 self.cla() 515 516 def get_children(self): /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axis.py in cla(self) 533 'clear the current axis' 534 self.set_major_locator(AutoLocator()) --> 535 self.set_major_formatter(ScalarFormatter()) 536 self.set_minor_locator(NullLocator()) 537 self.set_minor_formatter(NullFormatter()) /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/ticker.py in __init__(self, useOffset, useMathText) 269 self.format = '' 270 self._scientific = True --> 271 self._powerlimits = rcParams['axes.formatter.limits'] 272 273 def __call__(self, x, pos=None): KeyError: 'axes.formatter.limits' The thing is, I deleted my entire ~/.matplotlib directory, hoping to start clean. Where does matplotlib get its info when a .matplotlibrc is not present in my home directory? Thanks -- Chris Fonnesbeck + Atlanta, GA + http://trichech.us
On 1/31/07, Chris Fonnesbeck <ch...@tr...> wrote: > I am still getting this problem. Here is an ipython traceback of a very > simple plot: > > In [1]: from pylab import * Chris, try xmode verbose in ipython right before running your code. This will make the traceback dump even more detail, which may help John and his evil minions track down your little critter even faster. Cheers, f
>>>>> "Chris" == Chris Fonnesbeck <ch...@tr...> writes: Chris> The thing is, I deleted my entire ~/.matplotlib directory, Chris> hoping to start clean. Where does matplotlib get its info Chris> when a .matplotlibrc is not present in my home directory? It first looks in the current working dir and then in ~/.matplotlib Try running a sample script with --verbose-helpful and it will tell you which file is being read... JDH
On 1/31/07, John Hunter <jdh...@ac...> wrote: > > >>>>> "Chris" == Chris Fonnesbeck <ch...@tr...> writes: > > Chris> The thing is, I deleted my entire ~/.matplotlib directory, > Chris> hoping to start clean. Where does matplotlib get its info > Chris> when a .matplotlibrc is not present in my home directory? > > It first looks in the current working dir and then in ~/.matplotlib > > Try running a sample script with --verbose-helpful and it will tell > you which file is being read... > > I copied the matplotlibrc file from the source in svn; here is what I get using --verbose-helpful: Osoyoos:~ chris$ python plot.py --verbose-helpful plot.py:14: SyntaxWarning: import * only allowed at module level def main(): matplotlib data path /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data $HOME=/Users/chris CONFIGDIR=/Users/chris/.matplotlib loaded rc file /Users/chris/.matplotlib/matplotlibrc matplotlib version 0.87.7 verbose.level helpful interactive is False platform is darwin numerix numpy 1.0.2.dev3522 font search path ['/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data'] loaded ttfcache file /Users/chris/.matplotlib/ttffont.cache backend TkAgg version 8.4 Traceback (most recent call last): File "plot.py", line 20, in ? main() File "plot.py", line 16, in main plot(range(10), range(10)) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py", line 2038, in plot b = ishold() File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py", line 937, in ishold return gca().ishold() File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py", line 883, in gca ax = gcf().gca(**kwargs) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/figure.py", line 679, in gca return self.add_subplot(111, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/figure.py", line 506, in add_subplot a = Subplot(self, *args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py", line 4911, in __init__ Axes.__init__(self, fig, [self.figLeft, self.figBottom, File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py", line 439, in __init__ self._init_axis() File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py", line 470, in _init_axis self.xaxis = XAxis(self) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axis.py", line 514, in __init__ self.cla() File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axis.py", line 535, in cla self.set_major_formatter(ScalarFormatter()) File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/ticker.py", line 271, in __init__ self._powerlimits = rcParams['axes.formatter.limits'] KeyError: 'axes.formatter.limits' -- Chris Fonnesbeck + Atlanta, GA + http://trichech.us
Chris, My guess is that you have some combination of 0.87.7 and svn; the traceback says 0.87.7, and the KeyError is because of an addition to rcParams since 0.87.7. Try this: In [1]:import matplotlib In [2]:matplotlib.rcParams Out[2]: {'axes.axisbelow': False, 'axes.edgecolor': 'k', 'axes.facecolor': 'w', 'axes.formatter.limits': (-7, 7), 'axes.grid': False, 'axes.hold': True, etc. etc. If you don't see the axes.formatter.limits key then your __init__.py is not from svn. Maybe the thing to do is delete all versions and traces of matplotlib from your system and then re-download and install. Eric Chris Fonnesbeck wrote: > On 1/31/07, *John Hunter* <jdh...@ac... > <mailto:jdh...@ac...>> wrote: > > >>>>> "Chris" == Chris Fonnesbeck <ch...@tr... > <mailto:ch...@tr...>> writes: > > Chris> The thing is, I deleted my entire ~/.matplotlib directory, > Chris> hoping to start clean. Where does matplotlib get its info > Chris> when a .matplotlibrc is not present in my home directory? > > It first looks in the current working dir and then in ~/.matplotlib > > Try running a sample script with --verbose-helpful and it will tell > you which file is being read... > > > > I copied the matplotlibrc file from the source in svn; here is what I > get using --verbose-helpful: > > Osoyoos:~ chris$ python plot.py --verbose-helpful > plot.py:14: SyntaxWarning: import * only allowed at module level > def main(): > matplotlib data path > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data > > $HOME=/Users/chris > CONFIGDIR=/Users/chris/.matplotlib > loaded rc file /Users/chris/.matplotlib/matplotlibrc > matplotlib version 0.87.7 > verbose.level helpful > interactive is False > platform is darwin > numerix numpy 1.0.2.dev3522 > font search path > ['/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/mpl-data'] > loaded ttfcache file /Users/chris/.matplotlib/ttffont.cache > backend TkAgg version 8.4 > Traceback (most recent call last): > File "plot.py", line 20, in ? > main() > File "plot.py", line 16, in main > plot(range(10), range(10)) > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py", > line 2038, in plot > b = ishold() > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py", > line 937, in ishold > return gca().ishold() > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/pylab.py", > line 883, in gca > ax = gcf().gca(**kwargs) > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/figure.py", > line 679, in gca > return self.add_subplot(111, **kwargs) > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/figure.py", > line 506, in add_subplot > a = Subplot(self, *args, **kwargs) > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py", > line 4911, in __init__ > Axes.__init__(self, fig, [ self.figLeft, self.figBottom, > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py", > line 439, in __init__ > self._init_axis() > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axes.py", > line 470, in _init_axis > self.xaxis = XAxis(self) > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axis.py", > line 514, in __init__ > self.cla() > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/axis.py", > line 535, in cla > self.set_major_formatter(ScalarFormatter()) > File > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/ticker.py", > line 271, in __init__ > self._powerlimits = rcParams['axes.formatter.limits '] > KeyError: 'axes.formatter.limits' > > > > -- > Chris Fonnesbeck + Atlanta, GA + http://trichech.us > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users