Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d2569a3

Browse filesBrowse files
committed
Clarify semantics of plt.matshow(..., fignum=...).
The semantics of the fignum parameter are rather confusing (in particular wrt. whether the figure gets resized or not -- it only does if fignum=(None or a non-existing figure number) (which creates a new figure), but not if fignum=0 (which also creates a new figure). It's probably not worth fixing that (if anything we should just point users to Axes.matshow, which is just fine), but we can still improve the documentation.
1 parent e5c6c7c commit d2569a3
Copy full SHA for d2569a3

File tree

Expand file treeCollapse file tree

1 file changed

+7
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-10
lines changed

‎lib/matplotlib/pyplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pyplot.py
+7-10Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,18 +2412,15 @@ def matshow(A: ArrayLike, fignum: None | int = None, **kwargs) -> AxesImage:
24122412
The matrix to be displayed.
24132413
24142414
fignum : None or int
2415-
If *None*, create a new figure window with automatic numbering.
2415+
If *None*, create a new, appropriately sized figure window.
24162416
2417-
If a nonzero integer, draw into the figure with the given number
2418-
(create it if it does not exist).
2417+
If 0, use the current Axes (creating one if there is none, without ever
2418+
adjusting the figure size).
24192419
2420-
If 0, use the current axes (or create one if it does not exist).
2421-
2422-
.. note::
2423-
2424-
Because of how `.Axes.matshow` tries to set the figure aspect
2425-
ratio to be the one of the array, strange things may happen if you
2426-
reuse an existing figure.
2420+
Otherwise, create a new Axes on the figure with the given number
2421+
(creating it at the appropriate size if it does not exist, but not
2422+
adjusting the figure size otherwise). Note that this will be drawn on
2423+
top of any preexisting Axes on the figure.
24272424
24282425
Returns
24292426
-------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.