error in examples/contour_image.py ?

Hi, I am running on RHEL 3, Python 2.4.2, numarray 1.5.1, matplotlib 0.8.7.

I tried running the example contour_image.py (which works fine on my MacOS X.3.9
installation from fink), but I get these error messages:

    > python contour_image.py
    Traceback (most recent call last):
      File "contour_image.py", line 45, in ?
        cset2 = contour(X, Y, Z, cset1.levels, colors = 'k', hold='on')
      File "/opt/lib/python2.4/site-packages/matplotlib/pylab.py",
line 1856, in contour
        ret = gca().contour(*args, **kwargs)
      File "/opt/lib/python2.4/site-packages/matplotlib/axes.py", line
1293, in contour
        return ContourSet(self, *args, **kwargs)
      File "/opt/lib/python2.4/site-packages/matplotlib/contour.py",
line 428, in __init__
        self._process_colors()
      File "/opt/lib/python2.4/site-packages/matplotlib/contour.py",
line 626, in _process_colors
        self.set_norm(no_norm())
      File "/opt/lib/python2.4/site-packages/matplotlib/cm.py", line
85, in set_norm
        self.changed()
      File "/opt/lib/python2.4/site-packages/matplotlib/contour.py",
line 474, in changed
        tcolors = [ (tuple(rgba),) for rgba in self.to_rgba(self.cvalues)]
      File "/opt/lib/python2.4/site-packages/matplotlib/cm.py", line
52, in to_rgba
        if len(x.shape)>2: return x
      AttributeError: 'list' object has no attribute 'shape'

In fact, all the countour demo scripts give this error.

Seems odd that x is of the wrong class/type.

Any clues?

Cheers,
  Dave

···

--
Email: david.w.h.chin@...287...

David,

You ran into a bug I introduced while trying to fix another bug; a bugfix release is planned *very* soon.

Eric

David Chin wrote:

···

Hi, I am running on RHEL 3, Python 2.4.2, numarray 1.5.1, matplotlib 0.8.7.

I tried running the example contour_image.py (which works fine on my MacOS X.3.9
installation from fink), but I get these error messages:

    > python contour_image.py
    Traceback (most recent call last):
      File "contour_image.py", line 45, in ?
        cset2 = contour(X, Y, Z, cset1.levels, colors = 'k', hold='on')
      File "/opt/lib/python2.4/site-packages/matplotlib/pylab.py",
line 1856, in contour
        ret = gca().contour(*args, **kwargs)
      File "/opt/lib/python2.4/site-packages/matplotlib/axes.py", line
1293, in contour
        return ContourSet(self, *args, **kwargs)
      File "/opt/lib/python2.4/site-packages/matplotlib/contour.py",
line 428, in __init__
        self._process_colors()
      File "/opt/lib/python2.4/site-packages/matplotlib/contour.py",
line 626, in _process_colors
        self.set_norm(no_norm())
      File "/opt/lib/python2.4/site-packages/matplotlib/cm.py", line
85, in set_norm
        self.changed()
      File "/opt/lib/python2.4/site-packages/matplotlib/contour.py",
line 474, in changed
        tcolors = [ (tuple(rgba),) for rgba in self.to_rgba(self.cvalues)]
      File "/opt/lib/python2.4/site-packages/matplotlib/cm.py", line
52, in to_rgba
        if len(x.shape)>2: return x
      AttributeError: 'list' object has no attribute 'shape'

In fact, all the countour demo scripts give this error.

Seems odd that x is of the wrong class/type.

Any clues?

Cheers,
  Dave
--
Email: david.w.h.chin@...287...
N�HS^�隊X���'���u��<�ڂ�.���y�"��*m�x%jx.ja���^�קvƩ�X�jب�ȧ��m�ݚ���v&��קv�^�+����j�Z���{az���^��h��஋�n���)�{h�����ا�׫�+h�(m�����Z��jY�w��ǥrg�y$���Oxḝn�mj��^��ƭ�Z-�&��왨��x%��Lj�e��bn���b��,���y�+��޶em����+-��.�ǟ�����+-��b�ا~��j�e��bn�rs==

In the meantime, I was able to fix it by changing the
offending line in cm.py. Context diff attached.

Cheers,
Dave

cm.py.diff (550 Bytes)

···

On 2/24/06, Eric Firing <efiring@...202...> wrote:

David,

You ran into a bug I introduced while trying to fix another bug; a
bugfix release is planned *very* soon.

Eric

David Chin wrote:
> Hi, I am running on RHEL 3, Python 2.4.2, numarray 1.5.1, matplotlib 0.8.7.
>
> I tried running the example contour_image.py (which works fine on my MacOS X.3.9
> installation from fink), but I get these error messages:
>
> > python contour_image.py
> Traceback (most recent call last):
> File "contour_image.py", line 45, in ?
> cset2 = contour(X, Y, Z, cset1.levels, colors = 'k', hold='on')
> File "/opt/lib/python2.4/site-packages/matplotlib/pylab.py",
> line 1856, in contour
> ret = gca().contour(*args, **kwargs)
> File "/opt/lib/python2.4/site-packages/matplotlib/axes.py", line
> 1293, in contour
> return ContourSet(self, *args, **kwargs)
> File "/opt/lib/python2.4/site-packages/matplotlib/contour.py",
> line 428, in __init__
> self._process_colors()
> File "/opt/lib/python2.4/site-packages/matplotlib/contour.py",
> line 626, in _process_colors
> self.set_norm(no_norm())
> File "/opt/lib/python2.4/site-packages/matplotlib/cm.py", line
> 85, in set_norm
> self.changed()
> File "/opt/lib/python2.4/site-packages/matplotlib/contour.py",
> line 474, in changed
> tcolors = [ (tuple(rgba),) for rgba in self.to_rgba(self.cvalues)]
> File "/opt/lib/python2.4/site-packages/matplotlib/cm.py", line
> 52, in to_rgba
> if len(x.shape)>2: return x
> AttributeError: 'list' object has no attribute 'shape'
>
> In fact, all the countour demo scripts give this error.
>
> Seems odd that x is of the wrong class/type.
>
> Any clues?
>
> Cheers,
> Dave
> --
> Email: david.w.h.chin@...287...

--
Email: david.w.h.chin@...287...