@@ -6567,33 +6567,41 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
6567
6567
return spec , freqs , t , im
6568
6568
6569
6569
def spy (self , Z , precision = 0 , marker = None , markersize = None ,
6570
- aspect = 'equal' , ** kwargs ):
6570
+ aspect = 'equal' , origin = "upper" , ** kwargs ):
6571
6571
"""
6572
6572
Plot the sparsity pattern on a 2-D array.
6573
6573
6574
- Call signature::
6574
+ ``spy(Z)`` plots the sparsity pattern of the 2-D array *Z*.
6575
6575
6576
- spy(Z, precision=0, marker=None, markersize=None,
6577
- aspect='equal', **kwargs)
6576
+ Parameters
6577
+ ----------
6578
6578
6579
- ``spy(Z)`` plots the sparsity pattern of the 2-D array *Z*.
6579
+ Z : sparse array (n, m)
6580
+ The array to be plotted.
6580
6581
6581
- If *precision* is 0, any non-zero value will be plotted;
6582
- else, values of :math:`|Z| > precision` will be plotted.
6582
+ precision : float, optional, default: 0
6583
+ If *precision* is 0, any non-zero value will be plotted; else,
6584
+ values of :math:`|Z| > precision` will be plotted.
6583
6585
6584
- For :class:`scipy.sparse.spmatrix` instances, there is a
6585
- special case: if *precision* is 'present', any value present in
6586
- the array will be plotted, even if it is identically zero.
6586
+ For :class:`scipy.sparse.spmatrix` instances, there is a special
6587
+ case: if *precision* is 'present', any value present in the array
6588
+ will be plotted, even if it is identically zero.
6587
6589
6588
- The array will be plotted as it would be printed, with
6589
- the first index (row) increasing down and the second
6590
- index (column) increasing to the right .
6590
+ origin : ["upper", "lower"], optional, default: "upper"
6591
+ Place the [0,0] index of the array in the upper left or lower left
6592
+ corner of the axes .
6591
6593
6592
- By default aspect is 'equal', so that each array element
6593
- occupies a square space; set the aspect kwarg to 'auto'
6594
- to allow the plot to fill the plot box, or to any scalar
6595
- number to specify the aspect ratio of an array element
6596
- directly.
6594
+ aspect : ['auto' | 'equal' | scalar], optional, default: "equal"
6595
+
6596
+ If 'equal', and `extent` is None, changes the axes aspect ratio to
6597
+ match that of the image. If `extent` is not `None`, the axes
6598
+ aspect ratio is changed to match that of the extent.
6599
+
6600
+
6601
+ If 'auto', changes the image aspect ratio to match that of the
6602
+ axes.
6603
+
6604
+ If None, default to rc ``image.aspect`` value.
6597
6605
6598
6606
Two plotting styles are available: image or marker. Both
6599
6607
are available for full arrays, but only the marker style
@@ -6612,33 +6620,10 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
6612
6620
* *cmap*
6613
6621
* *alpha*
6614
6622
6615
- .. seealso::
6616
-
6617
- :func:`~matplotlib.pyplot.imshow`
6618
- For image options.
6619
-
6620
- For controlling colors, e.g., cyan background and red marks,
6621
- use::
6622
-
6623
- cmap = mcolors.ListedColormap(['c','r'])
6624
-
6625
- If *marker* or *markersize* is not *None*, useful kwargs include:
6626
-
6627
- * *marker*
6628
- * *markersize*
6629
- * *color*
6630
-
6631
- Useful values for *marker* include:
6632
-
6633
- * 's' square (default)
6634
- * 'o' circle
6635
- * '.' point
6636
- * ',' pixel
6637
-
6638
- .. seealso::
6639
-
6640
- :func:`~matplotlib.pyplot.plot`
6641
- For plotting options
6623
+ See also
6624
+ --------
6625
+ imshow : for image options.
6626
+ plot : for plotting options
6642
6627
"""
6643
6628
if marker is None and markersize is None and hasattr (Z , 'tocoo' ):
6644
6629
marker = 's'
@@ -6652,7 +6637,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
6652
6637
nr , nc = Z .shape
6653
6638
extent = [- 0.5 , nc - 0.5 , nr - 0.5 , - 0.5 ]
6654
6639
ret = self .imshow (mask , interpolation = 'nearest' , aspect = aspect ,
6655
- extent = extent , origin = 'upper' , ** kwargs )
6640
+ extent = extent , origin = origin , ** kwargs )
6656
6641
else :
6657
6642
if hasattr (Z , 'tocoo' ):
6658
6643
c = Z .tocoo ()
0 commit comments