8000 Merge pull request #6826 from anntzer/clarify-imshow-norm-docstring · matplotlib/matplotlib@4c4ead5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c4ead5

Browse files
committed
Merge pull request #6826 from anntzer/clarify-imshow-norm-docstring
DOC: Clarify doc for "norm" kwarg to `imshow`.
1 parent 5598853 commit 4c4ead5

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4956,21 +4956,22 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
49564956
Parameters
49574957
-----------
49584958
X : array_like, shape (n, m) or (n, m, 3) or (n, m, 4)
4959-
Display the image in `X` to current axes. `X` may be a float
4960-
array, a uint8 array or a PIL image. If `X` is an array, it
4961-
can have the following shapes:
4959+
Display the image in `X` to current axes. `X` may be an
4960+
array or a PIL image. If `X` is an array, it
4961+
can have the following shapes and types:
49624962
4963-
- MxN -- luminance (grayscale, float array only)
4964-
- MxNx3 -- RGB (float or uint8 array)
4965-
- MxNx4 -- RGBA (float or uint8 array)
4963+
- MxN -- values to be mapped (float or int)
4964+
- MxNx3 -- RGB (float or uint8)
4965+
- MxNx4 -- RGBA (float or uint8)
49664966
49674967
The value for each component of MxNx3 and MxNx4 float arrays
4968-
should be in the range 0.0 to 1.0; MxN float arrays may be
4969-
normalised.
4968+
should be in the range 0.0 to 1.0. MxN arrays are mapped
4969+
to colors based on the `norm` (mapping scalar to scalar)
4970+
and the `cmap` (mapping the normed scalar to a color).
49704971
49714972
cmap : `~matplotlib.colors.Colormap`, optional, default: None
4972-
If None, default to rc `image.cmap` value. `cmap` is ignored when
4973-
`X` has RGB(A) information
4973+
If None, default to rc `image.cmap` value. `cmap` is ignored
4974+
if `X` is 3-D, directly specifying RGB(A) values.
49744975
49754976
aspect : ['auto' | 'equal' | scalar], optional, default: None
49764977
If 'auto', changes the image aspect ratio to match that of the
@@ -4996,9 +4997,11 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
49964997
49974998
norm : `~matplotlib.colors.Normalize`, optional, default: None
49984999
A `~matplotlib.colors.Normalize` instance is used to scale
4999-
luminance data to 0, 1. If `None`, use the default
5000-
func:`normalize`. `norm` is only used if `X` is an array of
5001-
floats.
5000+
a 2-D float `X` input to the (0, 1) range for input to the
5001< 5C1B /td>+
`cmap`. If `norm` is None, use the default func:`normalize`.
5002+
If `norm` is an instance of `~matplotlib.colors.NoNorm`,
5003+
`X` must be an array of integers that index directly into
5004+
the lookup table of the `cmap`.
50025005
50035006
vmin, vmax : scalar, optional, default: None
50045007
`vmin` and `vmax` are used in conjunction with norm to normalize

0 commit comments

Comments
 (0)
0