healpy.projaxes.SphericalProjAxes.pcolor

SphericalProjAxes.pcolor(*args, **kwargs)

Create a pseudocolor plot of a 2-D array.

Note

pcolor can be very slow for large arrays; consider using the similar but much faster pcolormesh() instead.

Call signatures:

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

C is the array of color values.

X and Y, if given, specify the (x, y) coordinates 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]).

Ideally the dimensions of X and Y should be one greater than those of C; if the dimensions are the same, then the last row and column of C will be ignored.

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

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

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.

Keyword arguments:

cmap: [ None | Colormap ]
A matplotlib.colors.Colormap instance. If None, use rc settings.
norm: [ None | Normalize ]
An 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’ | ‘faceted’ ]

If ‘faceted’, a black grid is drawn around each rectangle; if ‘flat’, edges are not drawn. Default is ‘flat’, contrary to MATLAB.

This kwarg is deprecated; please use ‘edgecolors’ instead:
  • shading=’flat’ – edgecolors=’none’
  • shading=’faceted – edgecolors=’k’
edgecolors: [ None | 'none' | color | color sequence]

If None, the rc setting is used by default.

If 'none', edges will not be visible.

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.Collection instance.

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.

kwargs can be used to control the PolyCollection properties:

agg_filter: unknown alpha: float or None animated: [True | False] antialiased or antialiaseds: Boolean or sequence of booleans array: unknown axes: an Axes instance 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 arg or sequence of rgba tuples facecolor or facecolors: matplotlib color arg or sequence of rgba tuples figure: a matplotlib.figure.Figure instance gid: an id string hatch: [ ‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’ ] label: string or anything printable with ‘%s’ conversion. linestyle or linestyles or dashes: [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) ] linewidth or lw or linewidths: float or sequence of floats lod: [True | False] 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

Note

The default antialiaseds is False if the default edgecolors*=”none” is used. This eliminates artificial lines at patch boundaries, and works regardless of the value of alpha. If *edgecolors is not “none”, then the default antialiaseds is taken from rcParams[‘patch.antialiased’], which defaults to True. Stroking the edges may be preferred if alpha is 1, but will cause artifacts otherwise.

See also

pcolormesh()
For an explanation of the differences between pcolor and pcolormesh.