matplotlib.pyplot.figimage
-
matplotlib.pyplot.figimage(X, xo=0, yo=0, alpha=None, norm=None, cmap=None, vmin=None, vmax=None, origin=None, resize=False, **kwargs)[source] -
Add a non-resampled image to the figure.
The image is attached to the lower or upper left corner depending on origin.
Parameters: - X
-
The image data. This is an array of one of the following shapes:
- MxN: luminance (grayscale) values
- MxNx3: RGB values
- MxNx4: RGBA values
-
xo, yoint -
The x/y image offset in pixels.
-
alphaNone or float -
The alpha blending value.
-
normmatplotlib.colors.Normalize -
A
Normalizeinstance to map the luminance to the interval [0, 1]. -
cmapstr or matplotlib.colors.Colormap, default: rcParams["image.cmap"] (default: 'viridis') -
The colormap to use.
-
vmin, vmaxfloat -
If norm is not given, these values set the data limits for the colormap.
-
origin{'upper', 'lower'}, default: rcParams["image.origin"] (default: 'upper') -
Indicates where the [0, 0] index of the array is in the upper left or lower left corner of the axes.
-
resizebool -
If True, resize the figure to match the given image size.
Returns: Other Parameters: - **kwargs
-
Additional kwargs are
Artistkwargs passed on toFigureImage.
Notes
figimage complements the Axes image (
imshow) which will be resampled to fit the current Axes. If you want a resampled image to fill the entire figure, you can define anAxeswith extent [0, 0, 1, 1].Examples
f = plt.figure() nx = int(f.get_figwidth() * f.dpi) ny = int(f.get_figheight() * f.dpi) data = np.random.random((ny, nx)) f.figimage(data) plt.show()
Examples using matplotlib.pyplot.figimage
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.4.1/api/_as_gen/matplotlib.pyplot.figimage.html