Axes.pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None, vmax=None, shading='flat', antialiased=False, data=None, **kwargs)
Create a pseudocolor plot with a non-regular rectangular grid.
pcolor([X, Y,] C, **kwargs)
X and Y can be used to specify the corners of the quadrilaterals.
C may be a masked array. If
C[i, j] is masked, the corresponding quadrilateral will be transparent. Masking of X and Y is not supported. Use
pcolor if you need this functionality.
The grid orientation follows the standard matrix convention: An array C with shape (nrows, ncolumns) is plotted with the column number as X and the row number as Y.
Differences between pcolor() and pcolormesh()
Both methods are used to create a pseudocolor plot of a 2-D array using quadrilaterals.
The main difference lies in the created object and internal data handling: While
pcolor returns a
pcolormesh returns a
QuadMesh. The latter is more specialized for the given purpose and thus is faster. It should almost always be preferred.
There is also a slight difference in the handling of masked arrays. Both
pcolormesh support masked arrays for C. However, only
pcolor supports masked arrays for X and Y. The reason lies in the internal handling of the masked values.
pcolor leaves out the respective polygons from the PolyCollection.
pcolormesh sets the facecolor of the masked elements to transparent. You can see the difference when using edgecolors. While all edges are drawn irrespective of masking in a QuadMesh, the edge between two adjacent masked quadrilaterals in
pcolor is not drawn as the corresponding polygons do not exist in the PolyCollection.
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>]:
Objects passed as data must support item access (
data[<arg>]) and membership test (
<arg> in data).
© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.