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

Skip to content

Commit 3046e25

Browse files
authored
Merge pull request #10991 from timhoffm/doc-axes-matshow
Improve docstring of Axes.matshow
2 parents 98bfb96 + 8734412 commit 3046e25

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7390,14 +7390,14 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
73907390

73917391
def matshow(self, Z, **kwargs):
73927392
"""
7393-
Plot a matrix or array as an image.
7393+
Plot the values of a 2D matrix or array as color-coded image.
73947394
73957395
The matrix will be shown the way it would be printed, with the first
73967396
row at the top. Row and column numbering is zero-based.
73977397
73987398
Parameters
73997399
----------
7400-
Z : array_like shape (n, m)
7400+
Z : array-like(N, M)
74017401
The matrix to be displayed.
74027402
74037403
Returns
@@ -7407,12 +7407,21 @@ def matshow(self, Z, **kwargs):
74077407
Other Parameters
74087408
----------------
74097409
**kwargs : `~matplotlib.axes.Axes.imshow` arguments
7410-
Sets `origin` to 'upper', 'interpolation' to 'nearest' and
7411-
'aspect' to equal.
74127410
7413-
See also
7411+
See Also
74147412
--------
7415-
imshow : plot an image
7413+
imshow : More general function to plot data on a 2D regular raster.
7414+
7415+
Notes
7416+
-----
7417+
This is just a convenience function wrapping `.imshow` to set useful
7418+
defaults for a displaying a matrix. In particular:
7419+
7420+
- Set ``origin='upper'``.
7421+
- Set ``interpolation='nearest'``.
7422+
- Set ``aspect='equal'``.
7423+
- Ticks are placed to the left and above.
7424+
- Ticks are formatted to show integer indices.
74167425
74177426
"""
74187427
Z = np.asanyarray(Z)

0 commit comments

Comments
 (0)