This Page


Axes.pcolorfast(*args, **kwargs)

pseudocolor plot of a 2-D array

Experimental; this is a pcolor-type method that provides the fastest possible rendering with the Agg backend, and that can handle any quadrilateral grid. It supports only flat shading (no outlines), it lacks support for log scaling of the axes, and it does not have a pyplot wrapper.

Call signatures:

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

C is the 2D array of color values corresponding to quadrilateral cells. Let (nr, nc) be its shape. C may be a masked array.

ax.pcolorfast(C, **kwargs) is equivalent to ax.pcolorfast([0,nc], [0,nr], C, **kwargs)

xr, yr specify the ranges of x and y corresponding to the rectangular region bounding C. If:

xr = [x0, x1]


yr = [y0,y1]

then x goes from x0 to x1 as the second index of C goes from 0 to nc, etc. (x0, y0) is the outermost corner of cell (0,0), and (x1, y1) is the outermost corner of cell (nr-1, nc-1). All cells are rectangles of the same size. This is the fastest version.

x, y are monotonic 1D arrays of length nc +1 and nr +1, respectively, giving the x and y boundaries of the cells. Hence the cells are rectangular but the grid may be nonuniform. The speed is intermediate. (The grid is checked, and if found to be uniform the fast version is used.)

X and Y are 2D arrays with shape (nr +1, nc +1) that specify the (x,y) coordinates of the corners of the colored quadrilaterals; the quadrilateral for C[i,j] has corners at (X[i,j],Y[i,j]), (X[i,j+1],Y[i,j+1]), (X[i+1,j],Y[i+1,j]), (X[i+1,j+1],Y[i+1,j+1]). The cells need not be rectangular. 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.

Note that the column index corresponds to the x-coordinate, and the row index corresponds to y; for details, see Grid Orientation.

Optional keyword arguments:

cmap: [ None | Colormap ]
A matplotlib.colors.Colormap instance from cm. If None, use rc settings.
norm: [ None | Normalize ]
A matplotlib.colors.Normalize instance is used to scale luminance data to 0,1. If None, defaults to normalize()
vmin/vmax: [ None | scalar ]
vmin and vmax are used in conjunction with norm to normalize luminance data. If either are None, the min and max of the color array C is used. If you pass a norm instance, vmin and vmax will be None.
alpha: 0 <= scalar <= 1 or None
the alpha blending value

Return value is an image if a regular or rectangular grid is specified, and a QuadMesh collection in the general quadrilateral case.


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.