matplotlib.pyplot.tripcolor#

matplotlib.pyplot.tripcolor(*args,alpha=1.0,norm=None,cmap=None,vmin=None,vmax=None,shading='flat',facecolors=None,**kwargs)[source]#

Create a pseudocolor plot of an unstructured triangular grid.

Call signatures:

tripcolor(triangulation,c,*,...)tripcolor(x,y,c,*,[triangles=triangles],[mask=mask],...)

The triangular grid can be specified either by passing aTriangulationobject as the first parameter, or by passing the pointsx,y andoptionally thetriangles and amask. SeeTriangulation for anexplanation of these parameters.

It is possible to pass the triangles positionally, i.e.tripcolor(x,y,triangles,c,...). However, this is discouraged.For more clarity, passtriangles via keyword argument.

If neither oftriangulation ortriangles are given, the triangulationis calculated on the fly. In this case, it does not make sense to providecolors at the triangle faces viac orfacecolors because there aremultiple possible triangulations for a group of points and you don't knowwhich triangles will be constructed.

Parameters:
triangulationTriangulation

An already created triangular grid.

x, y, triangles, mask

Parameters defining the triangular grid. SeeTriangulation.This is mutually exclusive with specifyingtriangulation.

carray-like

The color values, either for the points or for the triangles. Which oneis automatically inferred from the length ofc, i.e. does it matchthe number of points or the number of triangles. If there are the samenumber of points and triangles in the triangulation it is assumed thatcolor values are defined at points; to force the use of color values attriangles use the keyword argumentfacecolors=c instead of justc.This parameter is position-only.

facecolorsarray-like, optional

Can be used alternatively toc to specify colors at the trianglefaces. This parameter takes precedence overc.

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

If 'flat' and the color valuesc are defined at points, the colorvalues used for each triangle are from the mean c of the triangle'sthree points. Ifshading is 'gouraud' then color values must bedefined at points.

cmapstr orColormap, default:rcParams["image.cmap"] (default:'viridis')

The Colormap instance or registered colormap name used to map scalar datato colors.

normstr orNormalize, optional

The normalization method used to scale scalar data to the [0, 1] rangebefore mapping to colors usingcmap. By default, a linear scaling isused, mapping the lowest value to 0 and the highest to 1.

If given, this can be one of the following:

vmin, vmaxfloat, optional

When using scalar data and no explicitnorm,vmin andvmax definethe data range that the colormap covers. By default, the colormap coversthe complete value range of the supplied data. It is an error to usevmin/vmax when anorm instance is given (but using astrnormname together withvmin/vmax is acceptable).

colorizerColorizer or None, default: None

The Colorizer object used to map color to data. If None, a Colorizerobject is created from anorm andcmap.

Returns:
PolyCollection orTriMesh

The result depends onshading: Forshading='flat' the result is aPolyCollection, forshading='gouraud' the result is aTriMesh.

Other Parameters:
**kwargsCollection properties

Property

Description

agg_filter

a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image

alpha

array-like or float or None

animated

bool

antialiased oraa orantialiaseds

bool or list of bools

array

array-like or None

capstyle

CapStyle or {'butt', 'projecting', 'round'}

clim

(vmin: float, vmax: float)

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

cmap

Colormap or str or None

color

color or list of RGBA tuples

edgecolor orec oredgecolors

color or list ofcolor or 'face'

facecolor orfacecolors orfc

color or list ofcolor

figure

Figure orSubFigure

gid

str

hatch

{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}

hatch_linewidth

unknown

in_layout

bool

joinstyle

JoinStyle or {'miter', 'round', 'bevel'}

label

object

linestyle ordashes orlinestyles orls

str or tuple or list thereof

linewidth orlinewidths orlw

float or list of floats

mouseover

bool

norm

Normalize or str or None

offset_transform ortransOffset

Transform

offsets

(N, 2) or (2,) array-like

path_effects

list ofAbstractPathEffect

paths

unknown

picker

None or bool or float or callable

pickradius

float

rasterized

bool

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

transform

Transform

url

str

urls

list of str or None

visible

bool

zorder

float

Notes

Examples usingmatplotlib.pyplot.tripcolor#

Tripcolor Demo

Tripcolor Demo