@@ -4397,66 +4397,7 @@ def specgram(self, x, NFFT=256, Fs=2, detrend=detrend_none,
43974397
43984398 return Pxx , freqs , bins , im
43994399
4400- def spy (self , Z , marker = 's' , markersize = 10 , precision = None , ** kwargs ):
4401- """
4402- SPY(Z, **kwargs) plots the sparsity pattern of the matrix Z
4403- using plot markers.
4404-
4405- The line handles are returned
4406-
4407- if precision is None, any non-zero value will be plotted
4408- if precision is not None, values of absolute(Z)>precision will be plotted
4409-
4410- kwargs control the Line2D properties of the markers:
4411- %(Line2D)s
4412- """
4413- if hasattr (Z , 'tocoo' ):
4414- c = Z .tocoo ()
4415- x = c .row
4416- y = c .col
4417- z = c .data
4418- else :
4419- Z = asarray (Z )
4420- if precision is None : mask = Z != 0.
4421- else : mask = absolute (Z )> precision
4422- x ,y ,z = matplotlib .mlab .get_xyz_where (Z , mask )
4423- return self .plot (x + 0.5 ,y + 0.5 , linestyle = 'None' ,
4424- marker = marker ,markersize = markersize , ** kwargs )
4425- spy .__doc__ = spy .__doc__ % artist .kwdocd
4426-
4427- def spy2 (self , Z , precision = None , ** kwargs ):
4428- """
4429- SPY2(Z) plots the sparsity pattern of the matrix Z as an image
4430-
4431- if precision is None, any non-zero value will be plotted
4432- if precision is not None, values of absolute(Z)>precision will be plotted
4433-
4434- kwargs are passed on to imshow; see help imshow for valid kwargs
4435-
4436- The image instance is returned
4437- """
4438-
4439- #binary colormap min white, max black
4440- Z = asarray (Z )
4441-
4442- if precision is None : mask = Z != 0.
4443- else : mask = absolute (Z )> precision
4444-
4445- Z = where (mask , 1. , 0. )
4446-
4447- kwargs = kwargs .copy ()
4448- if 'cmap' not in kwargs :
4449- cmapdata = {
4450- 'red' : ((0. , 1. , 1. ), (1. , 0. , 0. )),
4451- 'green' : ((0. , 1. , 1. ), (1. , 0. , 0. )),
4452- 'blue' : ((0. , 1. , 1. ), (1. , 0. , 0. ))
4453- }
4454- binary = LinearSegmentedColormap ('binary' , cmapdata , 2 )
4455- kwargs ['cmap' ] = binary
4456-
4457- return self .imshow (transpose (Z ), interpolation = 'nearest' , ** kwargs )
4458-
4459- def spy3 (self , Z , precision = None , marker = None , markersize = None ,
4400+ def spy (self , Z , precision = None , marker = None , markersize = None ,
44604401 aspect = 'equal' , ** kwargs ):
44614402 """
44624403 spy(Z) plots the sparsity pattern of the 2-D array Z
0 commit comments