'plot' broken on latest svn

Hello,

I've just updated to the latest svn (5063) and now I cannot create a simple plot. If I just try (in ipython -pylab):

plot(rand(10))

I get:

<type 'exceptions.AttributeError'>: 'module' object has no attribute 'masked_invalid'

The complete traceback is pasted below.
(My numpy version is 1.0.4, which indeed has no 'numpy.ma.masked_invalid'.)

Regards,
Antonio

···

---------------------------------------------------------------------------

In [1]: plot(rand(10))
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call last)

/home/antgon/heka/<ipython console> in <module>()

/usr/local/lib/python2.5/site-packages/matplotlib/pyplot.py in plot(*args, **kwargs)
    1826 hold(h)
    1827 try:
-> 1828 ret = gca().plot(*args, **kwargs)
    1829 draw_if_interactive()
    1830 except:

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in plot(self, *args, **kwargs)
    2803
    2804 for line in self._get_lines(*args, **kwargs):
-> 2805 self.add_line(line)
    2806 lines.append(line)
    2807

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in add_line(self, line)
    1163 line.set_clip_path(self.axesPatch)
    1164
-> 1165 self._update_line_limits(line)
    1166 if not line.get_label():
    1167 line.set_label('_line%d'%len(self.lines))

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in _update_line_limits(self, line)
    1171 def _update_line_limits(self, line):
    1172 xydata = line.get_xydata()
-> 1173 self.update_datalim( xydata )
    1174
    1175 def add_patch(self, p):

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in update_datalim(self, xys)
    1219 if not ma.isMaskedArray(xys):
    1220 xys = npy.asarray(xys)
-> 1221 self.dataLim.update_from_data_xy(xys, self.ignore_existing_data_limits)
    1222 self.ignore_existing_data_limits = False
    1223

/usr/local/lib/python2.5/site-packages/matplotlib/transforms.py in update_from_data_xy(self, xy, ignore)
     694 if len(xy) == 0:
     695 return
--> 696 xym = ma.masked_invalid(xy)
     697 if (xym.count(axis=1)!=2).all():
     698 return

<type 'exceptions.AttributeError'>: 'module' object has no attribute 'masked_invalid'

Antonio,

Thanks for the report. It should be fixed now. Numpy svn has masked_invalid, so my earlier change worked for me, and I forgot that ma.masked_invalid is a new addition (and a nice one).

Eric

Antonio Gonzalez wrote:

···

Hello,

I've just updated to the latest svn (5063) and now I cannot create a simple plot. If I just try (in ipython -pylab):

plot(rand(10))

I get:

<type 'exceptions.AttributeError'>: 'module' object has no attribute 'masked_invalid'

The complete traceback is pasted below.
(My numpy version is 1.0.4, which indeed has no 'numpy.ma.masked_invalid'.)

Regards,
Antonio
---------------------------------------------------------------------------

In [1]: plot(rand(10))
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call last)

/home/antgon/heka/<ipython console> in <module>()

/usr/local/lib/python2.5/site-packages/matplotlib/pyplot.py in plot(*args, **kwargs)
    1826 hold(h)
    1827 try:
-> 1828 ret = gca().plot(*args, **kwargs)
    1829 draw_if_interactive()
    1830 except:

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in plot(self, *args, **kwargs)
    2803
    2804 for line in self._get_lines(*args, **kwargs):
-> 2805 self.add_line(line)
    2806 lines.append(line)
    2807

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in add_line(self, line)
    1163 line.set_clip_path(self.axesPatch)
    1164
-> 1165 self._update_line_limits(line)
    1166 if not line.get_label():
    1167 line.set_label('_line%d'%len(self.lines))

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in _update_line_limits(self, line)
    1171 def _update_line_limits(self, line):
    1172 xydata = line.get_xydata()
-> 1173 self.update_datalim( xydata )
    1174
    1175 def add_patch(self, p):

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in update_datalim(self, xys)
    1219 if not ma.isMaskedArray(xys):
    1220 xys = npy.asarray(xys)
-> 1221 self.dataLim.update_from_data_xy(xys, self.ignore_existing_data_limits)
    1222 self.ignore_existing_data_limits = False
    1223

/usr/local/lib/python2.5/site-packages/matplotlib/transforms.py in update_from_data_xy(self, xy, ignore)
     694 if len(xy) == 0:
     695 return
--> 696 xym = ma.masked_invalid(xy)
     697 if (xym.count(axis=1)!=2).all():
     698 return

<type 'exceptions.AttributeError'>: 'module' object has no attribute 'masked_invalid'

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

My svn build of numpy does have numpy.ma.masked_invalid. Try building
numpy from svn instead of using 1.0.4. It's quite stable and has lots
of new features, plus it even passes all the numpy.tests.

···

On Wed, Apr 23, 2008 at 4:45 AM, Antonio Gonzalez <jag57@...776...> wrote:

Hello,

I've just updated to the latest svn (5063) and now I cannot create a
simple plot. If I just try (in ipython -pylab):

plot(rand(10))

I get:

<type 'exceptions.AttributeError'>: 'module' object has no attribute
'masked_invalid'

The complete traceback is pasted below.
(My numpy version is 1.0.4, which indeed has no 'numpy.ma.masked_invalid'.)

Regards,
Antonio
---------------------------------------------------------------------------

In [1]: plot(rand(10))
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call last)

/home/antgon/heka/<ipython console> in <module>()

/usr/local/lib/python2.5/site-packages/matplotlib/pyplot.py in
plot(*args, **kwargs)
    1826 hold(h)
    1827 try:
-> 1828 ret = gca().plot(*args, **kwargs)
    1829 draw_if_interactive()
    1830 except:

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in plot(self,
*args, **kwargs)
    2803
    2804 for line in self._get_lines(*args, **kwargs):
-> 2805 self.add_line(line)
    2806 lines.append(line)
    2807

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in
add_line(self, line)
    1163 line.set_clip_path(self.axesPatch)
    1164
-> 1165 self._update_line_limits(line)
    1166 if not line.get_label():
    1167 line.set_label('_line%d'%len(self.lines))

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in
_update_line_limits(self, line)
    1171 def _update_line_limits(self, line):
    1172 xydata = line.get_xydata()
-> 1173 self.update_datalim( xydata )
    1174
    1175 def add_patch(self, p):

/usr/local/lib/python2.5/site-packages/matplotlib/axes.py in
update_datalim(self, xys)
    1219 if not ma.isMaskedArray(xys):
    1220 xys = npy.asarray(xys)
-> 1221 self.dataLim.update_from_data_xy(xys,
self.ignore_existing_data_limits)
    1222 self.ignore_existing_data_limits = False
    1223

/usr/local/lib/python2.5/site-packages/matplotlib/transforms.py in
update_from_data_xy(self, xy, ignore)
     694 if len(xy) == 0:
     695 return
--> 696 xym = ma.masked_invalid(xy)
     697 if (xym.count(axis=1)!=2).all():
     698 return

<type 'exceptions.AttributeError'>: 'module' object has no attribute
'masked_invalid'

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

matplotlib svn requires numpy svn. Try upgrading your numpy and I
think this bug will go away.

JDH

···

On Wed, Apr 23, 2008 at 6:45 AM, Antonio Gonzalez <jag57@...776...> wrote:

Hello,

I've just updated to the latest svn (5063) and now I cannot create a
simple plot. If I just try (in ipython -pylab):

plot(rand(10))

I get:

<type 'exceptions.AttributeError'>: 'module' object has no attribute
'masked_invalid'

John Hunter wrote:

···

On Wed, Apr 23, 2008 at 6:45 AM, Antonio Gonzalez <jag57@...776...> wrote:

Hello,

I've just updated to the latest svn (5063) and now I cannot create a
simple plot. If I just try (in ipython -pylab):

plot(rand(10))

I get:

<type 'exceptions.AttributeError'>: 'module' object has no attribute
'masked_invalid'

matplotlib svn requires numpy svn. Try upgrading your numpy and I
think this bug will go away.

I put in a temporary workaround, but what we need is a numpy version check when mpl is imported. I can put something in based on parsing numpy.__version__; is there a better or more standard way to do this?

Eric

Eric Firing wrote:

John Hunter wrote:

Hello,

I've just updated to the latest svn (5063) and now I cannot create a
simple plot. If I just try (in ipython -pylab):

plot(rand(10))

I get:

<type 'exceptions.AttributeError'>: 'module' object has no attribute
'masked_invalid'

matplotlib svn requires numpy svn. Try upgrading your numpy and I
think this bug will go away.

I put in a temporary workaround, but what we need is a numpy version check when mpl is imported. I can put something in based on parsing numpy.__version__; is there a better or more standard way to do this?

Eric

Thanks for the replies. I'm now using numpy svn and all works well.
May I suggest, then -- maybe a warning should indeed arise at build time? Currently, mpl svn recognises non-svn numpy as an acceptable 'required dependency' during the building process (as reported at the beginning of the 'python setup.py build' output).

Antonio

···

On Wed, Apr 23, 2008 at 6:45 AM, Antonio Gonzalez <jag57@...776...> wrote:

Done in r5074. I don't have an older numpy lying around to test my
changes, but I think I got it right. In check_for_numpy:

    major, minor1, minor2 = map(int, numpy.__version__.split('.')[:3])
    if major<1 or (major==1 and minor1<1):
        print_status("numpy version", "no")
        print_message("You must install numpy 1.1 or later to build
matplotlib.")

        return False

JDH

···

On Fri, Apr 25, 2008 at 6:26 AM, Antonio Gonzalez <jag57@...776...> wrote:

Thanks for the replies. I'm now using numpy svn and all works well.
May I suggest, then -- maybe a warning should indeed arise at build
time? Currently, mpl svn recognises non-svn numpy as an acceptable
'required dependency' during the building process (as reported at the
beginning of the 'python setup.py build' output).

Antonio Gonzalez wrote:

Eric Firing wrote:

John Hunter wrote:

Hello,

I've just updated to the latest svn (5063) and now I cannot create a
simple plot. If I just try (in ipython -pylab):

plot(rand(10))

I get:

<type 'exceptions.AttributeError'>: 'module' object has no attribute
'masked_invalid'

matplotlib svn requires numpy svn. Try upgrading your numpy and I
think this bug will go away.

I put in a temporary workaround, but what we need is a numpy version check when mpl is imported. I can put something in based on parsing numpy.__version__; is there a better or more standard way to do this?

Eric

Thanks for the replies. I'm now using numpy svn and all works well.
May I suggest, then -- maybe a warning should indeed arise at build time? Currently, mpl svn recognises non-svn numpy as an acceptable 'required dependency' during the building process (as reported at the beginning of the 'python setup.py build' output).

Antonio,

Good idea. John beat me to it by a little less than an hour, so it is done now. I added the python 2.4 requirement.

Eric

···

On Wed, Apr 23, 2008 at 6:45 AM, Antonio Gonzalez <jag57@...776...> wrote:

Antonio