Spy on scipy.sparse.spmatrix

Hi all,

According to the `spy` docstring, it can display sparse matrices from
scipy. The following code snippet seems to break, however:

In [20]: import scipy.sparse as sp
In [21]: d = sp.lil_eye((15, 15))
In [22]: plt.spy(d)

Am I using the `spy` function correctly? I've also tried forcing
marker mode by setting marker='s' and markersize=1, but I still get
the same error message:

--> 160 gca()._sci(im)
    161
    162

/Users/stefan/lib/python2.6/site-packages/matplotlib/axes.pyc in _sci(self, im)
   1336 elif im not in self.images and im not in self.collections:
   1337 raise ValueError(
-> 1338 "Argument must be an image, collection, or
ContourSet in this Axes")
   1339 self._current_image = im
   1340

ValueError: Argument must be an image, collection, or ContourSet in this Axes

Kind regards and a happy festive season!
Stéfan

Stéfan van der Walt wrote:

Hi all,

According to the `spy` docstring, it can display sparse matrices from
scipy. The following code snippet seems to break, however:

In [20]: import scipy.sparse as sp
In [21]: d = sp.lil_eye((15, 15))
In [22]: plt.spy(d)

Am I using the `spy` function correctly? I've also tried forcing
marker mode by setting marker='s' and markersize=1, but I still get
the same error message:

It's a bug. The problem is that spy can return in image or a line with markers, but the pyplot wrapper is assuming it is returning an image. It will need a custom wrapper instead of the standard wrapper for functions returning a mappable. I'll fix it.

Eric

···

--> 160 gca()._sci(im)
    161
    162

/Users/stefan/lib/python2.6/site-packages/matplotlib/axes.pyc in _sci(self, im)
   1336 elif im not in self.images and im not in self.collections:
   1337 raise ValueError(
-> 1338 "Argument must be an image, collection, or
ContourSet in this Axes")
   1339 self._current_image = im
   1340

ValueError: Argument must be an image, collection, or ContourSet in this Axes

Kind regards and a happy festive season!
Stéfan

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev _______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Stéfan van der Walt wrote:

Hi all,

According to the `spy` docstring, it can display sparse matrices from
scipy. The following code snippet seems to break, however:

Fixed in the trunk.

Eric

···

In [20]: import scipy.sparse as sp
In [21]: d = sp.lil_eye((15, 15))
In [22]: plt.spy(d)

Am I using the `spy` function correctly? I've also tried forcing
marker mode by setting marker='s' and markersize=1, but I still get
the same error message:

--> 160 gca()._sci(im)
    161
    162

/Users/stefan/lib/python2.6/site-packages/matplotlib/axes.pyc in _sci(self, im)
   1336 elif im not in self.images and im not in self.collections:
   1337 raise ValueError(
-> 1338 "Argument must be an image, collection, or
ContourSet in this Axes")
   1339 self._current_image = im
   1340

ValueError: Argument must be an image, collection, or ContourSet in this Axes

Kind regards and a happy festive season!
Stéfan

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev _______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel