simple plot error in cvs build

For some reason, the current cvs build of matplotlib
generates a strange error:

import pylab
pylab.plot([1,2,3])

yields:

ValueError: arrays must have same number of dimensions

I thought perhaps a second array was required, but:

pylab.plot([1,2,3],[1,2,3])

yields the same error.

Anyone else getting this?

Here is a full debug of the call using ipython:

In [4]: pylab.plot([1,2,3])

···

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

/Users/chris/<ipython console>

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/pylab.py
in plot(*args=([1, 2, 3],), **kwargs={})
   2053 def plot(*args, **kwargs):
   2054 # allow callers to override the hold state
by passing hold=True|False
-> 2055 b = ishold()
        b = undefined
        global ishold = <function ishold at 0x175a270>
   2056 h = popd(kwargs, 'hold', None)
   2057 if h is not None:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/pylab.py
in ishold()
    937 Return the hold status of the current axes
    938 """
--> 939 return gca().ishold()
        global gca.ishold = undefined
    940
    941 def isinteractive():

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/pylab.py
in gca(**kwargs={})
    888 """
    889
--> 890 ax = gcf().gca(**kwargs)
        ax = undefined
        global gcf.gca = undefined
        kwargs = {}
    891 return ax
    892

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/figure.py
in gca(self=<matplotlib.figure.Figure instance at
0x16a3440>, **kwargs={})
    613 ax = self._axstack()
    614 if ax is not None: return ax
--> 615 return self.add_subplot(111, **kwargs)
        self.add_subplot = <bound method
Figure.add_subplot of <matplotlib.figure.Figure
instance at 0x16a3440>>
        kwargs = {}
    616
    617 def sca(self, a):

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/figure.py
in add_subplot(self=<matplotlib.figure.Figure instance
at 0x16a3440>, *args=(111,), **kwargs={})
    463 a = PolarSubplot(self, *args,
**kwargs)
    464 else:
--> 465 a = Subplot(self, *args,
**kwargs)
        a = undefined
        global Subplot = <class
matplotlib.axes.Subplot at 0x169ec30>
        self = <matplotlib.figure.Figure instance at
0x16a3440>
        args = (111,)
        kwargs = {}
    466
    467

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axes.py
in __init__(self=<matplotlib.axes.Subplot instance at
0x16e67d8>, fig=<matplotlib.figure.Figure instance at
0x16a3440>, *args=(111,), **kwargs={})
   3972 def __init__(self, fig, *args, **kwargs):
   3973 SubplotBase.__init__(self, fig, *args)
-> 3974 Axes.__init__(self, fig,
[self.figLeft, self.figBottom,
        global Axes.__init__ = <unbound method
Axes.__init__>
        self = <matplotlib.axes.Subplot instance at
0x16e67d8>
        fig = <matplotlib.figure.Figure instance at
0x16a3440>
        self.figLeft = 0.125
        self.figBottom = 0.099999999999999978
        self.figW = 0.77500000000000002
        self.figH = 0.80000000000000004
        kwargs = {}
   3975 self.figW,
self.figH], **kwargs)
   3976

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axes.py
in __init__(self=<matplotlib.axes.Subplot instance at
0x16e67d8>, fig=<matplotlib.figure.Figure instance at
0x16a3440>, rect=[0.125, 0.099999999999999978,
0.77500000000000002, 0.80000000000000004],
axisbg=None, frameon=True, sharex=None, sharey=None,
label='', **kwargs={})
    329
    330 # this call may differ for non-sep
axes, eg polar
--> 331 self._init_axis()
        self._init_axis = <bound method
Subplot._init_axis of <matplotlib.axes.Subplot
instance at 0x16e67d8>>
    332
    333

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axes.py
in _init_axis(self=<matplotlib.axes.Subplot instance
at 0x16e67d8>)
    358 def _init_axis(self):
    359 "move this out of __init__ because
non-separable axes don't use it"
--> 360 self.xaxis = XAxis(self)
        self.xaxis = undefined
        global XAxis = <class matplotlib.axis.XAxis at
0x167a060>
        self = <matplotlib.axes.Subplot instance at
0x16e67d8>
    361 self.yaxis = YAxis(self)
    362

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in __init__(self=<matplotlib.axis.XAxis instance at
0x177fb48>, axes=<matplotlib.axes.Subplot instance at
0x16e67d8>)
    499 self.minorTicks = []
    500
--> 501 self.cla()
        self.cla = <bound method XAxis.cla of
<matplotlib.axis.XAxis instance at 0x177fb48>>
    502
    503 def cla(self):

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in cla(self=<matplotlib.axis.XAxis instance at
0x177fb48>)
    522 popall(self.minorTicks)
    523
--> 524
self.majorTicks.extend([self._get_tick(major=True)
for i in range(1)])
        self.majorTicks.extend = <built-in method
extend of list object at 0x177fcb0>
        self._get_tick = <bound method XAxis._get_tick
of <matplotlib.axis.XAxis instance at 0x177fb48>>
        global major = undefined
        global True = undefined
        i = 0
        global range = undefined
    525
self.minorTicks.extend([self._get_tick(major=False)
for i in range(1)])
    526

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in _get_tick(self=<matplotlib.axis.XAxis instance at
0x177fb48>, major=True)
    832
    833 def _get_tick(self, major):
--> 834 return XTick(self.axes, 0, '',
major=major)
        global XTick = <class matplotlib.axis.XTick at
0x1614f60>
        self.axes = <matplotlib.axes.Subplot instance
at 0x16e67d8>
        major = True
    835
    836 def _get_label(self):

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in __init__(self=<matplotlib.axis.XTick instance at
0x177fe40>, axes=<matplotlib.axes.Subplot instance at
0x16e67d8>, loc=0, label='', size=4.0, gridOn=False,
tick1On=True, tick2On=True, label1On=True,
label2On=False, major=True)
     98
     99
--> 100 self.tick1line =
self._get_tick1line(loc)
        self.tick1line = undefined
        self._get_tick1line = <bound method
XTick._get_tick1line of <matplotlib.axis.XTick
instance at 0x177fe40>>
        loc = 0
    101 self.tick2line =
self._get_tick2line(loc)
    102 self.gridline =
self._get_gridline(loc)

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in _get_tick1line(self=<matplotlib.axis.XTick instance
at 0x177fe40>, loc=0)
    274 antialiased=False,
    275 marker =
self._xtickmarkers[0],
--> 276 markersize=self._size,
        global markersize = undefined
        self._size = 4.0
    277 )
    278

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/lines.py
in __init__(self=<matplotlib.lines.Line2D instance at
0x177fe90>, xdata=(0,), ydata=(0,), linewidth=1.0,
linestyle='None', color='k', marker=2, markersize=4.0,
markeredgewidth=0.5, markeredgecolor='black',
markerfacecolor='blue', antialiased=False,
dash_capstyle='butt', solid_capstyle='projecting',
dash_joinstyle='miter', solid_joinstyle='miter',
**kwargs={})
    209 self.verticalOffset = None
    210
--> 211 self.set_data(xdata, ydata)
        self.set_data = <bound method Line2D.set_data
of <matplotlib.lines.Line2D instance at 0x177fe90>>
        xdata = (0,)
        ydata = (0,)
    212
    213 if not
self._lineStyles.has_key(linestyle):

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/lines.py
in set_data(self=<matplotlib.lines.Line2D instance at
0x177fe90>, *args=((0,), (0,)))
    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)
        self._segments = undefined
        global unmasked_index_ranges = <function
unmasked_index_ranges at 0x1248970>
        mask = False
    283 else:
    284 self._segments = None

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/lines.py
in unmasked_index_ranges(mask=False, compressed=True)
     67
     68 '''
---> 69 m = concatenate(((1,), mask, (1,)))
        m = undefined
        global concatenate = <built-in function

        mask = False
     70 indices = arange(len(mask) + 1)
     71 mdif = m[1:] - m[:-1]

ValueError: arrays must have same number of dimensions

Judging from "matplotlib-0.86-py2.4-macosx-10.4-ppc.egg" I am guessing
you are not using cvs matplotlib. That is a strange error none the
less. 0.86.2 was released today. Can you give it a try?

···

On 1/24/06, Christopher Fonnesbeck <chris@...941...> wrote:

For some reason, the current cvs build of matplotlib
generates a strange error:

import pylab
pylab.plot([1,2,3])

yields:

ValueError: arrays must have same number of dimensions

I thought perhaps a second array was required, but:

pylab.plot([1,2,3],[1,2,3])

yields the same error.

Anyone else getting this?

Here is a full debug of the call using ipython:

In [4]: pylab.plot([1,2,3])
---------------------------------------------------------------------------
exceptions.ValueError
Traceback (most recent call last)

/Users/chris/<ipython console>

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/pylab.py
in plot(*args=([1, 2, 3],), **kwargs={})
   2053 def plot(*args, **kwargs):
   2054 # allow callers to override the hold state
by passing hold=True|False
-> 2055 b = ishold()
        b = undefined
        global ishold = <function ishold at 0x175a270>
   2056 h = popd(kwargs, 'hold', None)
   2057 if h is not None:

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/pylab.py
in ishold()
    937 Return the hold status of the current axes
    938 """
--> 939 return gca().ishold()
        global gca.ishold = undefined
    940
    941 def isinteractive():

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/pylab.py
in gca(**kwargs={})
    888 """
    889
--> 890 ax = gcf().gca(**kwargs)
        ax = undefined
        global gcf.gca = undefined
        kwargs = {}
    891 return ax
    892

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/figure.py
in gca(self=<matplotlib.figure.Figure instance at
0x16a3440>, **kwargs={})
    613 ax = self._axstack()
    614 if ax is not None: return ax
--> 615 return self.add_subplot(111, **kwargs)
        self.add_subplot = <bound method
Figure.add_subplot of <matplotlib.figure.Figure
instance at 0x16a3440>>
        kwargs = {}
    616
    617 def sca(self, a):

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/figure.py
in add_subplot(self=<matplotlib.figure.Figure instance
at 0x16a3440>, *args=(111,), **kwargs={})
    463 a = PolarSubplot(self, *args,
**kwargs)
    464 else:
--> 465 a = Subplot(self, *args,
**kwargs)
        a = undefined
        global Subplot = <class
matplotlib.axes.Subplot at 0x169ec30>
        self = <matplotlib.figure.Figure instance at
0x16a3440>
        args = (111,)
        kwargs = {}
    466
    467

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axes.py
in __init__(self=<matplotlib.axes.Subplot instance at
0x16e67d8>, fig=<matplotlib.figure.Figure instance at
0x16a3440>, *args=(111,), **kwargs={})
   3972 def __init__(self, fig, *args, **kwargs):
   3973 SubplotBase.__init__(self, fig, *args)
-> 3974 Axes.__init__(self, fig,
[self.figLeft, self.figBottom,
        global Axes.__init__ = <unbound method
Axes.__init__>
        self = <matplotlib.axes.Subplot instance at
0x16e67d8>
        fig = <matplotlib.figure.Figure instance at
0x16a3440>
        self.figLeft = 0.125
        self.figBottom = 0.099999999999999978
        self.figW = 0.77500000000000002
        self.figH = 0.80000000000000004
        kwargs = {}
   3975 self.figW,
self.figH], **kwargs)
   3976

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axes.py
in __init__(self=<matplotlib.axes.Subplot instance at
0x16e67d8>, fig=<matplotlib.figure.Figure instance at
0x16a3440>, rect=[0.125, 0.099999999999999978,
0.77500000000000002, 0.80000000000000004],
axisbg=None, frameon=True, sharex=None, sharey=None,
label='', **kwargs={})
    329
    330 # this call may differ for non-sep
axes, eg polar
--> 331 self._init_axis()
        self._init_axis = <bound method
Subplot._init_axis of <matplotlib.axes.Subplot
instance at 0x16e67d8>>
    332
    333

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axes.py
in _init_axis(self=<matplotlib.axes.Subplot instance
at 0x16e67d8>)
    358 def _init_axis(self):
    359 "move this out of __init__ because
non-separable axes don't use it"
--> 360 self.xaxis = XAxis(self)
        self.xaxis = undefined
        global XAxis = <class matplotlib.axis.XAxis at
0x167a060>
        self = <matplotlib.axes.Subplot instance at
0x16e67d8>
    361 self.yaxis = YAxis(self)
    362

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in __init__(self=<matplotlib.axis.XAxis instance at
0x177fb48>, axes=<matplotlib.axes.Subplot instance at
0x16e67d8>)
    499 self.minorTicks = []
    500
--> 501 self.cla()
        self.cla = <bound method XAxis.cla of
<matplotlib.axis.XAxis instance at 0x177fb48>>
    502
    503 def cla(self):

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in cla(self=<matplotlib.axis.XAxis instance at
0x177fb48>)
    522 popall(self.minorTicks)
    523
--> 524
self.majorTicks.extend([self._get_tick(major=True)
for i in range(1)])
        self.majorTicks.extend = <built-in method
extend of list object at 0x177fcb0>
        self._get_tick = <bound method XAxis._get_tick
of <matplotlib.axis.XAxis instance at 0x177fb48>>
        global major = undefined
        global True = undefined
        i = 0
        global range = undefined
    525
self.minorTicks.extend([self._get_tick(major=False)
for i in range(1)])
    526

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in _get_tick(self=<matplotlib.axis.XAxis instance at
0x177fb48>, major=True)
    832
    833 def _get_tick(self, major):
--> 834 return XTick(self.axes, 0, '',
major=major)
        global XTick = <class matplotlib.axis.XTick at
0x1614f60>
        self.axes = <matplotlib.axes.Subplot instance
at 0x16e67d8>
        major = True
    835
    836 def _get_label(self):

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in __init__(self=<matplotlib.axis.XTick instance at
0x177fe40>, axes=<matplotlib.axes.Subplot instance at
0x16e67d8>, loc=0, label='', size=4.0, gridOn=False,
tick1On=True, tick2On=True, label1On=True,
label2On=False, major=True)
     98
     99
--> 100 self.tick1line =
self._get_tick1line(loc)
        self.tick1line = undefined
        self._get_tick1line = <bound method
XTick._get_tick1line of <matplotlib.axis.XTick
instance at 0x177fe40>>
        loc = 0
    101 self.tick2line =
self._get_tick2line(loc)
    102 self.gridline =
self._get_gridline(loc)

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/axis.py
in _get_tick1line(self=<matplotlib.axis.XTick instance
at 0x177fe40>, loc=0)
    274 antialiased=False,
    275 marker =
self._xtickmarkers[0],
--> 276 markersize=self._size,
        global markersize = undefined
        self._size = 4.0
    277 )
    278

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/lines.py
in __init__(self=<matplotlib.lines.Line2D instance at
0x177fe90>, xdata=(0,), ydata=(0,), linewidth=1.0,
linestyle='None', color='k', marker=2, markersize=4.0,
markeredgewidth=0.5, markeredgecolor='black',
markerfacecolor='blue', antialiased=False,
dash_capstyle='butt', solid_capstyle='projecting',
dash_joinstyle='miter', solid_joinstyle='miter',
**kwargs={})
    209 self.verticalOffset = None
    210
--> 211 self.set_data(xdata, ydata)
        self.set_data = <bound method Line2D.set_data
of <matplotlib.lines.Line2D instance at 0x177fe90>>
        xdata = (0,)
        ydata = (0,)
    212
    213 if not
self._lineStyles.has_key(linestyle):

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/lines.py
in set_data(self=<matplotlib.lines.Line2D instance at
0x177fe90>, *args=((0,), (0,)))
    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)
        self._segments = undefined
        global unmasked_index_ranges = <function
unmasked_index_ranges at 0x1248970>
        mask = False
    283 else:
    284 self._segments = None

/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib-0.86-py2.4-macosx-10.4-ppc.egg/matplotlib/lines.py
in unmasked_index_ranges(mask=False, compressed=True)
     67
     68 '''
---> 69 m = concatenate(((1,), mask, (1,)))
        m = undefined
        global concatenate = <built-in function
>
        mask = False
     70 indices = arange(len(mask) + 1)
     71 mdif = m[1:] - m[:-1]

ValueError: arrays must have same number of dimensions

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Christopher Fonnesbeck wrote:

For some reason, the current cvs build of matplotlib
generates a strange error:

import pylab
pylab.plot([1,2,3])

yields:

ValueError: arrays must have same number of dimensions

I thought perhaps a second array was required, but:

pylab.plot([1,2,3],[1,2,3])

yields the same error.

Anyone else getting this?

Chris,

I'm not. Looking at your traceback, I see that your version of lines.py is not up-to-date, and is missing the changes required for numpy support that will solve this problem. There have been several such changes during the past week. Either there are big problems with CVS mirror lag, or you have not updated recently enough.

Eric

I think this was discussed on the devel list last week:

http://sourceforge.net/mailarchive/forum.php?thread_id=9520529&forum_id=36187

···

On Tuesday 24 January 2006 10:41 pm, Christopher Fonnesbeck wrote:

For some reason, the current cvs build of matplotlib
generates a strange error:

import pylab
pylab.plot([1,2,3])

yields:

ValueError: arrays must have same number of dimensions