8000 Backport PR #11565: Update docstring of pyplot.matshow() · matplotlib/matplotlib@f2f8483 · GitHub
[go: up one dir, main page]

Skip to content

Commit f2f8483

Browse files
jklymakMeeseeksDev[bot]
authored andcommitted
Backport PR #11565: Update docstring of pyplot.matshow()
1 parent dc6db47 commit f2f8483

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

lib/matplotlib/pyplot.py

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,7 +2378,7 @@ def imsave(*args, **kwargs):
23782378
return _imsave(*args, **kwargs)
23792379

23802380

2381-
def matshow(A, fignum=None, **kw):
2381+
def matshow(A, fignum=None, **kwargs):
23822382
"""
23832383
Display an array as a matrix in a new figure window.
23842384
@@ -2389,21 +2389,34 @@ def matshow(A, fignum=None, **kw):
23892389
23902390
Tick labels for the xaxis are placed on top.
23912391
2392-
With the exception of *fignum*, keyword arguments are passed to
2393-
:func:`~matplotlib.pyplot.imshow`. You may set the *origin*
2394-
kwarg to "lower" if you want the first row in the array to be
2395-
at the bottom instead of the top.
2392+
Parameters
2393+
----------
2394+
A : array-like(M, N)
2395+
The matrix to be displayed.
2396+
2397+
fignum : None or int or False
2398+
If *None*, create a new figure window with automatic numbering.
2399+
2400+
If *fignum* is an integer, draw into the figure with the given number
2401+
(create it if it does not exist).
2402+
2403+
If 0 or *False*, use the current axes if it exists instead of creating
2404+
a new figure.
2405+
2406+
.. note::
23962407
2408+
Because of how `.Axes.matshow` tries to set the figure aspect
2409+
ratio to be the one of the array, strange things may happen if you
2410+
reuse an existing figure.
23972411
2398-
*fignum*: [ None | integer | False ]
2399-
By default, :func:`matshow` creates a new figure window with
2400-
automatic numbering. If *fignum* is given as an integer, the
2401-
created figure will use this figure number. Because of how
2402-
:func:`matshow` tries to set the figure aspect ratio to be the
2403-
one of the array, if you provide the number of an already
2404-
existing figure, strange things may happen.
2412+
Returns
2413+
-------
2414+
image : `~matplotlib.image.AxesImage`
2415+
2416+
Other Parameters
2417+
----------------
2418+
**kwargs : `~matplotlib.axes.Axes.imshow` arguments
24052419
2406-
If *fignum* is *False* or 0, a new figure window will **NOT** be created.
24072420
"""
24082421
A = np.asanyarray(A)
24092422
if fignum is False or fignum is 0:
@@ -2413,7 +2426,7 @@ def matshow(A, fignum=None, **kw):
24132426
fig = figure(fignum, figsize=figaspect(A))
24142427
ax = fig.add_axes([0.15, 0.09, 0.775, 0.775])
24152428

2416-
im = ax.matshow(A, **kw)
2429+
im = ax.matshow(A, **kwargs)
24172430
sci(im)
24182431

24192432
return im

0 commit comments

Comments
 (0)
0