Fork me on GitHub


This Page


matplotlib.pyplot.pcolormesh(*args, **kwargs)

Plot a quadrilateral mesh.

Call signatures:

pcolormesh(X, Y, C)
pcolormesh(C, **kwargs)

Create a pseudocolor plot of a 2-D array.

pcolormesh is similar to pcolor(), but uses a different mechanism and returns a different object; pcolor returns a PolyCollection but pcolormesh returns a QuadMesh. It is much faster, so it is almost always preferred for large arrays.

C may be a masked array, but X and Y may not. Masked array support is implemented via cmap and norm; in contrast, pcolor() simply does not draw quadrilaterals with masked colors or vertices.

Keyword arguments:

cmap: [ None | Colormap ]
A matplotlib.colors.Colormap instance. 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 is None, it is autoscaled to the respective min or max of the color array C. If not None, vmin or vmax passed in here override any pre-existing values supplied in the norm instance.
shading: [ ‘flat’ | ‘gouraud’ ]
‘flat’ indicates a solid color for each quad. When ‘gouraud’, each quad will be Gouraud shaded. When gouraud shading, edgecolors is ignored.
edgecolors: [None | 'None' | 'face' | color |
color sequence]

If None, the rc setting is used by default.

If 'None', edges will not be visible.

If 'face', edges will have the same color as the faces.

An mpl color or sequence of colors will set the edge color

alpha: 0 <= scalar <= 1 or None
the alpha blending value

Return value is a matplotlib.collections.QuadMesh object.

kwargs can be used to control the matplotlib.collections.QuadMesh properties:

Property Description
agg_filter unknown
alpha float or None
animated [True | False]
antialiased or antialiaseds Boolean or sequence of booleans
array unknown
clim a length 2 sequence of floats
clip_box a matplotlib.transforms.Bbox instance
clip_on [True | False]
clip_path [ (Path, Transform) | Patch | None ]
cmap a colormap or registered colormap name
color matplotlib color arg or sequence of rgba tuples
contains a callable function
edgecolor or edgecolors matplotlib color spec or sequence of specs
facecolor or facecolors matplotlib color spec or sequence of specs
figure a matplotlib.figure.Figure instance
gid an id string
hatch [ ‘/’ | ‘' | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ]
label string or anything printable with ‘%s’ conversion.
linestyle or dashes or linestyles [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or linewidths or lw float or sequence of floats
norm unknown
offset_position unknown
offsets float or sequence of floats
path_effects unknown
picker [None|float|boolean|callable]
pickradius unknown
rasterized [True | False | None]
sketch_params unknown
snap unknown
transform Transform instance
url a url string
urls unknown
visible [True | False]
zorder any number

See also

For an explanation of the grid orientation (Grid Orientation) and the expansion of 1-D X and/or Y to 2-D arrays.


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.