Crashing

Hi,

On two different computers, I'm now unable to use matplotlib because it gets an exception.
I'm using Mac OS X 10.4.4, with fink installations of all packages (including python2.4):
In [7]: pylab.matplotlib.__version__
Out[7]: '0.86.1'

In [16]: numpy.__version__
Out[16]: '0.9.4'

In [10]: os.uname()
Out[10]:
('Darwin',
'Fezzik.local',
'8.4.0',
'Darwin Kernel Version 8.4.0: Tue Jan 3 18:22:10 PST 2006; root:xnu-792.6.56.obj~1/RELEASE_PPC',
'Power Macintosh')

I'm using numpy in my matplotlibrc.

Here is the error:

In [14]: pylab.plot()
/sw/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:991: GtkWarning: Could not find the icon 'gnome-fs-home'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
         http://freedesktop.org/Software/icon-theme/releases
   buttons)

···

---------------------------------------------------------------------------
exceptions.ValueError Traceback (most recent call last)

/Users/paulr/src/LWDA/progs/util/<console>

/sw/lib/python2.4/site-packages/matplotlib/pylab.py in plot(*args, **kwargs)
    2053 def plot(*args, **kwargs):
    2054 # allow callers to override the hold state by passing hold=True|False
-> 2055 b = ishold()
    2056 h = popd(kwargs, 'hold', None)
    2057 if h is not None:

/sw/lib/python2.4/site-packages/matplotlib/pylab.py in ishold()
     937 Return the hold status of the current axes
     938 """
--> 939 return gca().ishold()
     940
     941 def isinteractive():

/sw/lib/python2.4/site-packages/matplotlib/pylab.py in gca(**kwargs)
     888 """
     889
--> 890 ax = gcf().gca(**kwargs)
     891 return ax
     892

/sw/lib/python2.4/site-packages/matplotlib/figure.py in gca(self, **kwargs)
     613 ax = self._axstack()
     614 if ax is not None: return ax
--> 615 return self.add_subplot(111, **kwargs)
     616
     617 def sca(self, a):

/sw/lib/python2.4/site-packages/matplotlib/figure.py in add_subplot(self, *args, **kwargs)
     463 a = PolarSubplot(self, *args, **kwargs)
     464 else:
--> 465 a = Subplot(self, *args, **kwargs)
     466
     467

/sw/lib/python2.4/site-packages/matplotlib/axes.py in __init__(self, fig, *args, **kwargs)
    3972 def __init__(self, fig, *args, **kwargs):
    3973 SubplotBase.__init__(self, fig, *args)
-> 3974 Axes.__init__(self, fig, [self.figLeft, self.figBottom,
    3975 self.figW, self.figH], **kwargs)
    3976

/sw/lib/python2.4/site-packages/matplotlib/axes.py in __init__(self, fig, rect, axisbg, frameon, sharex, sharey, label, **kwargs)
     329
     330 # this call may differ for non-sep axes, eg polar
--> 331 self._init_axis()
     332
     333

/sw/lib/python2.4/site-packages/matplotlib/axes.py in _init_axis(self)
     358 def _init_axis(self):
     359 "move this out of __init__ because non-separable axes don't use it"
--> 360 self.xaxis = XAxis(self)
     361 self.yaxis = YAxis(self)
     362

/sw/lib/python2.4/site-packages/matplotlib/axis.py in __init__(self, axes)
     499 self.minorTicks = []
     500
--> 501 self.cla()
     502
     503 def cla(self):

/sw/lib/python2.4/site-packages/matplotlib/axis.py in cla(self)
     522 popall(self.minorTicks)
     523
--> 524 self.majorTicks.extend([self._get_tick(major=True) for i in range(1)])
     525 self.minorTicks.extend([self._get_tick(major=False) for i in range(1)])
     526

/sw/lib/python2.4/site-packages/matplotlib/axis.py in _get_tick(self, major)
     832
     833 def _get_tick(self, major):
--> 834 return XTick(self.axes, 0, '', major=major)
     835
     836 def _get_label(self):

/sw/lib/python2.4/site-packages/matplotlib/axis.py in __init__(self, axes, loc, label, size, gridOn, tick1On, tick2On, label1On, label2On, major)
      98
      99
--> 100 self.tick1line = self._get_tick1line(loc)
     101 self.tick2line = self._get_tick2line(loc)
     102 self.gridline = self._get_gridline(loc)

/sw/lib/python2.4/site-packages/matplotlib/axis.py in _get_tick1line(self, loc)
     274 antialiased=False,
     275 marker = self._xtickmarkers[0],
--> 276 markersize=self._size,
     277 )
     278

/sw/lib/python2.4/site-packages/matplotlib/lines.py in __init__(self, xdata, ydata, linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, antialiased, dash_capstyle, solid_capstyle, dash_joinstyle, solid_joinstyle, **kwargs)
     209 self.verticalOffset = None
     210
--> 211 self.set_data(xdata, ydata)
     212
     213 if not self._lineStyles.has_key(linestyle):

/sw/lib/python2.4/site-packages/matplotlib/lines.py in set_data(self, *args)
     280 x = ma.masked_array(x, mask=mask).compressed()
     281 y = ma.masked_array(y, mask=mask).compressed()
--> 282 self._segments = unmasked_index_ranges(mask)
     283 else:
     284 self._segments = None

/sw/lib/python2.4/site-packages/matplotlib/lines.py in unmasked_index_ranges(mask, compressed)
      67
      68 '''
---> 69 m = concatenate(((1,), mask, (1,)))
      70 indices = arange(len(mask) + 1)
      71 mdif = m[1:] - m[:-1]

ValueError: arrays must have same number of dimensions

Any ideas?

Thanks,

-- Paul

--
Dr. Paul S. Ray E-mail: Paul.Ray@...706...
Naval Research Laboratory WWW : http://xweb.nrl.navy.mil/personnel/paulr/
Code 7655 Phone : (202) 404-1619
Washington, DC 20375 AIM : NRLPSR

Paul,

This one has tripped up a lot of people. It is caused by a version mismatch between numpy and mpl; you need a more recent mpl to work with up-to-date numpy. CVS should be OK, and I think 0.86.2 is also OK.

Eric

Paul Ray wrote:

Hi,

On two different computers, I'm now unable to use matplotlib because it gets an exception.
I'm using Mac OS X 10.4.4, with fink installations of all packages (including python2.4):
In [7]: pylab.matplotlib.__version__
Out[7]: '0.86.1'

In [16]: numpy.__version__
Out[16]: '0.9.4'

In [10]: os.uname()
Out[10]:
('Darwin',
'Fezzik.local',
'8.4.0',
'Darwin Kernel Version 8.4.0: Tue Jan 3 18:22:10 PST 2006; root:xnu-792.6.56.obj~1/RELEASE_PPC',
'Power Macintosh')

I'm using numpy in my matplotlibrc.

Here is the error:

[........]

···

/sw/lib/python2.4/site-packages/matplotlib/lines.py in unmasked_index_ranges(mask, compressed)
     67
     68 '''
---> 69 m = concatenate(((1,), mask, (1,)))
     70 indices = arange(len(mask) + 1)
     71 mdif = m[1:] - m[:-1]

ValueError: arrays must have same number of dimensions

Any ideas?