matplotlib.pyplot.
pcolor
(*args, **kwargs)¶Create a pseudocolor plot of a 2D array.
Call signatures:
pcolor(C, **kwargs)
pcolor(X, Y, C, **kwargs)
pcolor can be very slow for large arrays; consider
using the similar but much faster
pcolormesh()
instead.
Parameters:  C : array_like
X, Y : array_like, optional
cmap :
norm :
vmin, vmax : scalar, optional, default: None edgecolors : {None, ‘none’, color, color sequence}
alpha : scalar, optional, default: None
snap : bool, optional, default: False



Returns:  collection : 

Other Parameters:  
antialiaseds : bool, optional, default: False
**kwargs :

See also
pcolormesh
Notes
X
, Y
and C
may be masked arrays. If either C[i, j], or one
of the vertices surrounding C[i,j] (X
or Y
at [i, j], [i+1, j],
[i, j+1], [i+1, j+1]) is masked, nothing is plotted.
The grid orientation follows the MATLAB convention: an array C
with
shape (nrows, ncolumns) is plotted with the column number as X
and
the row number as Y
, increasing up; hence it is plotted the way the
array would be printed, except that the Y
axis is reversed. That
is, C
is taken as C
(y, x).
Similarly for meshgrid()
:
x = np.arange(5)
y = np.arange(3)
X, Y = np.meshgrid(x, y)
is equivalent to:
X = array([[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4]])
Y = array([[0, 0, 0, 0, 0],
[1, 1, 1, 1, 1],
[2, 2, 2, 2, 2]])
so if you have:
C = rand(len(x), len(y))
then you need to transpose C:
pcolor(X, Y, C.T)
or:
pcolor(C.T)
MATLAB pcolor()
always discards the last row and column of C
,
but Matplotlib displays the last row and column if X
and Y
are
not specified, or if X
and Y
have one more row and column than
C
.
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>]: