Skip to content

Backport PR #27244 on branch v3.8.x (Clarify semantics of plt.matshow(..., fignum=...).) #27246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2413,18 +2413,15 @@ def matshow(A: ArrayLike, fignum: None | int = None, **kwargs) -> AxesImage:
The matrix to be displayed.

fignum : None or int
If *None*, create a new figure window with automatic numbering.
If *None*, create a new, appropriately sized figure window.

If a nonzero integer, draw into the figure with the given number
(create it if it does not exist).
If 0, use the current Axes (creating one if there is none, without ever
adjusting the figure size).

If 0, use the current axes (or create one if it does not exist).

.. note::

Because of how `.Axes.matshow` tries to set the figure aspect
ratio to be the one of the array, strange things may happen if you
reuse an existing figure.
Otherwise, create a new Axes on the figure with the given number
(creating it at the appropriate size if it does not exist, but not
adjusting the figure size otherwise). Note that this will be drawn on
top of any preexisting Axes on the figure.

Returns
-------
Expand Down