Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5432720

Browse files
committed
Merge branch 'add_option_to_spy'
Conflicts: CHANGELOG
2 parents 1f11b60 + 0307662 commit 5432720

File tree

2 files changed

+33
-46
lines changed

2 files changed

+33
-46
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343

4444
2014-03-13 Add parameter 'clockwise' to function pie, True by default.
4545

46+
2014-02-28 Added 'origin' kwarg to `spy`
47+
4648
2014-02-27 Implemented separate horizontal/vertical axes padding to the
4749
ImageGrid in the AxesGrid toolkit
4850

lib/matplotlib/axes/_axes.py

Lines changed: 31 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6567,33 +6567,41 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None,
65676567
return spec, freqs, t, im
65686568

65696569
def spy(self, Z, precision=0, marker=None, markersize=None,
6570-
aspect='equal', **kwargs):
6570+
aspect='equal', origin="upper", **kwargs):
65716571
"""
65726572
Plot the sparsity pattern on a 2-D array.
65736573
6574-
Call signature::
6574+
``spy(Z)`` plots the sparsity pattern of the 2-D array *Z*.
65756575
6576-
spy(Z, precision=0, marker=None, markersize=None,
6577-
aspect='equal', **kwargs)
6576+
Parameters
6577+
----------
65786578
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.
65806581
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.
65836585
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.
65876589
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.
65916593
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.
65976605
65986606
Two plotting styles are available: image or marker. Both
65996607
are available for full arrays, but only the marker style
@@ -6612,33 +6620,10 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
66126620
* *cmap*
66136621
* *alpha*
66146622
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
66426627
"""
66436628
if marker is None and markersize is None and hasattr(Z, 'tocoo'):
66446629
marker = 's'
@@ -6652,7 +6637,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
66526637
nr, nc = Z.shape
66536638
extent = [-0.5, nc - 0.5, nr - 0.5, -0.5]
66546639
ret = self.imshow(mask, interpolation='nearest', aspect=aspect,
6655-
extent=extent, origin='upper', **kwargs)
6640+
extent=extent, origin=origin, **kwargs)
66566641
else:
66576642
if hasattr(Z, 'tocoo'):
66586643
c = Z.tocoo()

0 commit comments

Comments
 (0)