Skip to content

Commit 16abfd3

Browse files
committed
Clarify doc for "norm" kwarg to imshow.
"norm" also applies when X is a 2D-array of integers -- i.e, similarly to the "cmap" kwarg. Make the docs for the two kwargs consistent.
1 parent 2a7f606 commit 16abfd3

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

lib/matplotlib/axes/_axes.py

+16-13
Original file line numberDiff line numberDiff line change
@@ -4944,21 +4944,22 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
49444944
Parameters
49454945
-----------
49464946
X : array_like, shape (n, m) or (n, m, 3) or (n, m, 4)
4947-
Display the image in `X` to current axes. `X` may be a float
4948-
array, a uint8 array or a PIL image. If `X` is an array, it
4949-
can have the following shapes:
4947+
Display the image in `X` to current axes. `X` may be an
4948+
array or a PIL image. If `X` is an array, it
4949+
can have the following shapes and types:
49504950
4951-
- MxN -- luminance (grayscale, float array only)
4952-
- MxNx3 -- RGB (float or uint8 array)
4953-
- MxNx4 -- RGBA (float or uint8 array)
4951+
- MxN -- values to be mapped (float or int)
4952+
- MxNx3 -- RGB (float or uint8)
4953+
- MxNx4 -- RGBA (float or uint8)
49544954
49554955
The value for each component of MxNx3 and MxNx4 float arrays
4956-
should be in the range 0.0 to 1.0; MxN float arrays may be
4957-
normalised.
4956+
should be in the range 0.0 to 1.0. MxN arrays are mapped
4957+
to colors based on the `norm` (mapping scalar to scalar)
4958+
and the `cmap` (mapping the normed scalar to a color).
49584959
49594960
cmap : `~matplotlib.colors.Colormap`, optional, default: None
4960-
If None, default to rc `image.cmap` value. `cmap` is ignored when
4961-
`X` has RGB(A) information
4961+
If None, default to rc `image.cmap` value. `cmap` is ignored
4962+
if `X` is 3-D, directly specifying RGB(A) values.
49624963
49634964
aspect : ['auto' | 'equal' | scalar], optional, default: None
49644965
If 'auto', changes the image aspect ratio to match that of the
@@ -4984,9 +4985,11 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
49844985
49854986
norm : `~matplotlib.colors.Normalize`, optional, default: None
49864987
A `~matplotlib.colors.Normalize` instance is used to scale
4987-
luminance data to 0, 1. If `None`, use the default
4988-
func:`normalize`. `norm` is only used if `X` is an array of
4989-
floats.
4988+
a 2-D float `X` input to the (0, 1) range for input to the
4989+
`cmap`. If `norm` is None, use the default func:`normalize`.
4990+
If `norm` is an instance of `~matplotlib.colors.NoNorm`,
4991+
`X` must be an array of integers that index directly into
4992+
the lookup table of the `cmap`.
49904993
49914994
vmin, vmax : scalar, optional, default: None
49924995
`vmin` and `vmax` are used in conjunction with norm to normalize

0 commit comments

Comments
 (0)