MCPcopy
hub / github.com/matplotlib/matplotlib / imshow

Method imshow

lib/matplotlib/axes/_axes.py:6147–6391  ·  view source on GitHub ↗

Display data as an image, i.e., on a 2D regular raster. The input may either be actual RGB(A) data, or 2D scalar data, which will be rendered as a pseudocolor image. For displaying a grayscale image, set up the colormapping using the parameters ``cmap='gray'

(self, X, cmap=None, norm=None, *, aspect=None,
               interpolation=None, alpha=None,
               vmin=None, vmax=None, colorizer=None, origin=None, extent=None,
               interpolation_stage=None, filternorm=True, filterrad=4.0,
               resample=None, url=None, **kwargs)

Source from the content-addressed store, hash-verified

6145 @_preprocess_data()
6146 @_docstring.interpd
6147 def imshow(self, X, cmap=None, norm=None, *, aspect=None,
6148 interpolation=None, alpha=None,
6149 vmin=None, vmax=None, colorizer=None, origin=None, extent=None,
6150 interpolation_stage=None, filternorm=True, filterrad=4.0,
6151 resample=None, url=None, **kwargs):
6152 """
6153 Display data as an image, i.e., on a 2D regular raster.
6154
6155 The input may either be actual RGB(A) data, or 2D scalar data, which
6156 will be rendered as a pseudocolor image. For displaying a grayscale
6157 image, set up the colormapping using the parameters
6158 ``cmap='gray', vmin=0, vmax=255``.
6159
6160 The number of pixels used to render an image is set by the Axes size
6161 and the figure *dpi*. This can lead to aliasing artifacts when
6162 the image is resampled, because the displayed image size will usually
6163 not match the size of *X* (see
6164 :doc:`/gallery/images_contours_and_fields/image_antialiasing`).
6165 The resampling can be controlled via the *interpolation* parameter
6166 and/or :rc:`image.interpolation`.
6167
6168 Parameters
6169 ----------
6170 X : array-like or PIL image
6171 The image data. Supported array shapes are:
6172
6173 - (M, N): an image with scalar data. The values are mapped to
6174 colors using normalization and a colormap. See parameters *norm*,
6175 *cmap*, *vmin*, *vmax*.
6176 - (M, N, 3): an image with RGB values (0-1 float or 0-255 int).
6177 - (M, N, 4): an image with RGBA values (0-1 float or 0-255 int),
6178 i.e. including transparency.
6179
6180 The first two dimensions (M, N) define the rows and columns of
6181 the image.
6182
6183 Out-of-range RGB(A) values are clipped.
6184
6185 %(cmap_doc)s
6186
6187 This parameter is ignored if *X* is RGB(A).
6188
6189 %(norm_doc)s
6190
6191 This parameter is ignored if *X* is RGB(A).
6192
6193 %(vmin_vmax_doc)s
6194
6195 This parameter is ignored if *X* is RGB(A).
6196
6197 %(colorizer_doc)s
6198
6199 This parameter is ignored if *X* is RGB(A).
6200
6201 aspect : {'equal', 'auto'} or float or None, default: None
6202 The aspect ratio of the Axes. This parameter is particularly
6203 relevant for images since it determines whether data pixels are
6204 square.

Callers 15

specgramMethod · 0.95
spyMethod · 0.95
matshowMethod · 0.95
__call__Method · 0.80
imshow_rgbMethod · 0.80
test_inset_locatorFunction · 0.80
test_inset_axesFunction · 0.80

Calls 14

set_extentMethod · 0.95
get_extentMethod · 0.95
is_transform_setMethod · 0.80
add_imageMethod · 0.80
contains_branchMethod · 0.45
get_transformMethod · 0.45
set_aspectMethod · 0.45
set_dataMethod · 0.45
set_alphaMethod · 0.45
get_clip_pathMethod · 0.45
set_clip_pathMethod · 0.45

Tested by 15

test_inset_locatorFunction · 0.64
test_inset_axesFunction · 0.64
test_image_gridFunction · 0.64
test_hbox_dividerFunction · 0.64
test_vbox_dividerFunction · 0.64
test_imagegridFunction · 0.64