matplotlib.pyplot.pcolormesh
阅读原文时间:2023年07月16日阅读:1

matplotlib.pyplot.``pcolormesh(*argsalpha=Nonenorm=Nonecmap=Nonevmin=Nonevmax=Noneshading='flat'antialiased=Falsedata=None**kwargs) 创建一个带有不规则矩形网格的伪彩色图

Parameters:

C : array_like

A scalar 2-D array. The values will be color-mapped.

X, Y : array_like, optional

The coordinates of the quadrilateral corners. The quadrilateral for C[i,j] has corners at:

(X[i+1, j], Y[i+1, j]) (X[i+1, j+1], Y[i+1, j+1])
+--------+
| C[i,j] |
+--------+
(X[i, j], Y[i, j]) (X[i, j+1], Y[i, j+1]),

Note that the column index corresponds to the x-coordinate, and the row index corresponds to y. For details, see the Notes section below.

The dimensions of X and Y should be one greater than those of C. Alternatively, XY and C may have equal dimensions, in which case the last row and column of C will be ignored.

If X and/or Y are 1-D arrays or column vectors they will be expanded as needed into the appropriate 2-D arrays, making a rectangular grid.

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"]](https://matplotlib.org/tutorials/introductory/customizing.html#matplotlib-rcparams).

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.

Normalize实例将数据值缩放到用于映射到颜色的规范化colormap范围[0,1]。默认情况下,使用线性缩放将数据范围映射到colorbar范围。

vmin, vmax : scalar, optional, default: None

The colorbar range. If None, suitable min/max values are automatically chosen by the Normalizeinstance (defaults to  the respective min/max values of C in case of the default linear scaling).

edgecolors : {'none', None, 'face', color, color sequence}, optional

  边缘颜色,默认None:

  • 'none' or '': No edge.
  • None[rcParams["patch.edgecolor"]](https://matplotlib.org/tutorials/introductory/customizing.html#matplotlib-rcparams) will be used. Note that currently[rcParams["patch.force_edgecolor"]](https://matplotlib.org/tutorials/introductory/customizing.html#matplotlib-rcparams) has to be True for this to work.
  • 'face': Use the adjacent face color.
  • An mpl color or sequence of colors will set the edge color.

The singular form edgecolor works as an alias.

alpha : scalar, optional, default: None

  透明度

shading : {'flat', 'gouraud'}, optional

The fill style, Possible values:

填充式样

  • 'flat': A solid color is used for each quad. The color of the quad (i, j), (i+1, j), (i, j+1), (i+1, j+1) is given by C[i,j].
  • 'gouraud': Each quad will be Gouraud shaded: The color of the corners (i', j') are given by C[i',j']. The color values of the area in between is interpolated from the corner values. When Gouraud shading is used, edgecolors is ignored.

snap : bool, optional, default: False

Whether to snap the mesh to pixel boundaries.

Returns:

mesh : [matplotlib.collections.QuadMesh](https://matplotlib.org/api/collections_api.html#matplotlib.collections.QuadMesh)