Create a pseudocolor plot with a non-regular rectangular grid.
Call signature:
ax.pcolorfast([X, Y], C, /, **kwargs)
This method is similar to pcolor
and pcolormesh
. It's designed to provide the fastest pcolor-type plotting with the Agg backend. To achieve this, it uses different algorithms internally depending on the complexity of the input grid (regular rectangular, non-regular rectangular or arbitrary quadrilateral).
Warning
This method is experimental. Compared to pcolor
or pcolormesh
it has some limitations:
The image data. Supported array shapes are:
The first two dimensions (M, N) define the rows and columns of the image.
This parameter can only be passed positionally.
(0, N)
, (0, M)
X and Y are used to specify the coordinates of the quadrilaterals. There are different ways to do this:
Use tuples X=(xmin, xmax)
and Y=(ymin, ymax)
to define a uniform rectangular grid.
The tuples define the outer edges of the grid. All individual quadrilaterals will be of the same size. This is the fastest version.
Use 1D arrays X, Y to specify a non-uniform rectangular grid.
In this case X and Y have to be monotonic 1D arrays of length N+1 and M+1, specifying the x and y boundaries of the cells.
The speed is intermediate. Note: The grid is checked, and if found to be uniform the fast version is used.
Use 2D arrays X, Y if you need an arbitrary quadrilateral grid (i.e. if the quadrilaterals are not rectangular).
In this case X and Y are 2D arrays with shape (M + 1, N + 1), specifying the x and y coordinates of the corners of the colored quadrilaterals.
This is the most general, but the slowest to render. It may produce faster and more compact output using ps, pdf, and svg backends, however.
These arguments can only be passed positionally.
Colormap
, default: rcParams["image.cmap"]
(default: 'viridis'
)
A Colormap instance or registered colormap name. The colormap maps the C values to colors.
Normalize
, optional
The Normalize instance scales the data values to the canonical colormap range [0, 1] for mapping to colors. By default, the data range is mapped to the colorbar range using linear scaling.
The colorbar range. If None, suitable min/max values are automatically chosen by the Normalize
instance (defaults to the respective min/max values of C in case of the default linear scaling). It is an error to use vmin/vmax when norm is given.
The alpha blending value, between 0 (transparent) and 1 (opaque).
Whether to snap the mesh to pixel boundaries.
AxesImage
or PcolorImage
or QuadMesh
The return type depends on the type of grid:
AxesImage
for a regular rectangular grid.PcolorImage
for a non-regular rectangular grid.QuadMesh
for a non-rectangular grid.If given, all parameters also accept a string s
, which is interpreted as data[s]
(unless this raises an exception).
Supported additional parameters depend on the type of grid. See return types of image for further description.
matplotlib.axes.Axes.pcolorfast
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.5.1/api/_as_gen/matplotlib.axes.Axes.pcolorfast.html