>>>>> "Robert" == Robert Cimrman <[EMAIL PROTECTED]> writes:
Robert> It looks like the 'spy' function ignores negative values
Robert> (matplotlib 0.87.5).
Robert> In [30]:spy( ones( (5, 5) ) )[0].get_xdata() Out[30]:
Robert> array([ 0.5, 0.5, 0.5, 0.5, 0.5, 1.5, 1.5, 1.5, 1.5, 1.5,
Robert> 2.5, 2.5, 2.5, 2.5, 2.5, 3.5, 3.5, 3.5, 3.5, 3.5, 4.5,
Robert> 4.5, 4.5, 4.5, 4.5])
Robert> In [31]:spy( -ones( (5, 5) ) )[0].get_xdata()
Robert> Out[31]:array([], type=Float)
The implementation of spy is pretty simple:
def spy(self, Z, marker='s', markersize=10, **kwargs):
"""
SPY(Z, **kwargs) plots the sparsity pattern of the matrix Z
using plot markers.
The line handles are returned
kwargs control the Line2D properties of the markers:
%(Line2D)s
"""
if hasattr(Z, 'tocoo'):
c = Z.tocoo()
x = c.row
y = c.col
z = c.data
else:
x,y,z = matplotlib.mlab.get_xyz_where(Z, Z>0)
return self.plot(x+0.5,y+0.5, linestyle='None',
marker=marker,markersize=markersize, **kwargs)
I am not a spy user, though I wrote it. I assume the test should be Z!=0?
Note spy2 (which arguably makes a nicer plot) has the same potential
problem. If there is consensus that it should be !=0 I am happy to
change it.
JDH
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users