Skip to content

Commit 578af6b

Browse files
committed
Update docstring of pyplot.matshow()
1 parent 9fc98c9 commit 578af6b

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
@@ -2148,7 +2148,7 @@ def imsave(fname, arr, **kwargs):
21482148
return matplotlib.image.imsave(fname, arr, **kwargs)
21492149

21502150

2151-
def matshow(A, fignum=None, **kw):
2151+
def matshow(A, fignum=None, **kwargs):
21522152
"""
21532153
Display an array as a matrix in a new figure window.
21542154
@@ -2159,21 +2159,34 @@ def matshow(A, fignum=None, **kw):
21592159
21602160
Tick labels for the xaxis are placed on top.
21612161
2162-
With the exception of *fignum*, keyword arguments are passed to
2163-
:func:`~matplotlib.pyplot.imshow`. You may set the *origin*
2164-
kwarg to "lower" if you want the first row in the array to be
2165-
at the bottom instead of the top.
2162+
Parameters
2163+
----------
2164+
A : array-like(M, N)
2165+
The matrix to be displayed.
2166+
2167+
fignum : None or int or False
2168+
If *None*, create a new figure window with automatic numbering.
2169+
2170+
If *fignum* is an integer, draw into the figure with the given number
2171+
(create it if it does not exist).
2172+
2173+
If 0 or *False*, use the current axes if it exists instead of creating
2174+
a new figure.
2175+
2176+
.. note::
21662177
2178+
Because of how `.Axes.matshow` tries to set the figure aspect
2179+
ratio to be the one of the array, strange things may happen if you
2180+
reuse an existing figure.
21672181
2168-
*fignum*: [ None | integer | False ]
2169-
By default, :func:`matshow` creates a new figure window with
2170-
automatic numbering. If *fignum* is given as an integer, the
2171-
created figure will use this figure number. Because of how
2172-
:func:`matshow` tries to set the figure aspect ratio to be the
2173-
one of the array, if you provide the number of an already
2174-
existing figure, strange things may happen.
2182+
Returns
2183+
-------
2184+
image : `~matplotlib.image.AxesImage`
2185+
2186+
Other Parameters
2187+
----------------
2188+
**kwargs : `~matplotlib.axes.Axes.imshow` arguments
21752189
2176-
If *fignum* is *False* or 0, a new figure window will **NOT** be created.
21772190
"""
21782191
A = np.asanyarray(A)
21792192
if fignum is False or fignum is 0:
@@ -2183,7 +2196,7 @@ def matshow(A, fignum=None, **kw):
21832196
fig = figure(fignum, figsize=figaspect(A))
21842197
ax = fig.add_axes([0.15, 0.09, 0.775, 0.775])
21852198

2186-
im = ax.matshow(A, **kw)
2199+
im = ax.matshow(A, **kwargs)
21872200
sci(im)
21882201

21892202
return im

0 commit comments

Comments
 (0)