You are reading an old version of the documentation (v2.2.3). For the latest version see https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.pcolorfast.html
Version 2.2.3
matplotlib
Fork me on GitHub

Table Of Contents

matplotlib.axes.Axes.pcolorfast

Axes.pcolorfast(*args, data=None, **kwargs)[source]

Create a pseudocolor plot with a non-regular rectangular grid.

Call signatures:

ax.pcolorfast(C, **kwargs)
ax.pcolorfast(xr, yr, C, **kwargs)
ax.pcolorfast(x, y, C, **kwargs)
ax.pcolorfast(X, Y, C, **kwargs)

This method is similar to ~.Axes.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:

  • It supports only flat shading (no outlines)
  • It lacks support for log scaling of the axes.
  • It does not have a have a pyplot wrapper.
Parameters:
C : array-like(M, N)

A scalar 2D array. The values will be color-mapped. C may be a masked array.

x, y : tuple or array-like

X and Y are used to specify the coordinates of the quadilaterals. There are different ways to do this:

  • Use tuples xr=(xmin, xmax) and yr=(ymin, ymax) to define a uniform rectiangular 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, N), specifying the x and y coordinates of the corners of the colored quadrilaterals. See pcolormesh for details.

    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.

Leaving out x and y defaults to xr=(0, N), yr=(O, M).

cmap : str or Colormap, optional

A Colormap instance or registered colormap name. The colormap maps the C values to colors. Defaults to rcParams["image.cmap"].

norm : 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.

vmin, vmax : scalar, optional, default: None

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).

alpha : scalar, optional, default: None

The alpha blending value, between 0 (transparent) and 1 (opaque).

snap : bool, optional, default: False

Whether to snap the mesh to pixel boundaries.

Returns:
image : AxesImage or PcolorImage or QuadMesh

The return type depends on the type of grid:

Notes

Note

In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[<arg>]:

  • All positional and all keyword arguments.

Examples using matplotlib.axes.Axes.pcolorfast