mpl_toolkits.mplot3d.art3d.Poly3DCollection

class mpl_toolkits.mplot3d.art3d.Poly3DCollection(verts, *args, zsort='average', **kwargs)[source]

Bases: matplotlib.collections.PolyCollection

A collection of 3D polygons.

Note

Filling of 3D polygons

There is no simple definition of the enclosed surface of a 3D polygon unless the polygon is planar.

In practice, Matplotlib fills the 2D projection of the polygon. This gives a correct filling appearance only for planar polygons. For all other polygons, you'll find orientations in which the edges of the polygon intersect in the projection. This will lead to an incorrect visualization of the 3D area.

If you need filled areas, it is recommended to create them via plot_trisurf, which creates a triangulation and thus generates consistent surfaces.

Parameters:
vertslist of array-like Nx3

Each element describes a polygon as a sequence of N_i points (x, y, z).

zsort{'average', 'min', 'max'}, default: 'average'

The calculation method for the z-order. See set_zsort for details.

*args, **kwargs

All other parameters are forwarded to PolyCollection.

Notes

Note that this class does a bit of magic with the _facecolors and _edgecolors properties.

__init__(verts, *args, zsort='average', **kwargs)[source]
Parameters:
vertslist of array-like Nx3

Each element describes a polygon as a sequence of N_i points (x, y, z).

zsort{'average', 'min', 'max'}, default: 'average'

The calculation method for the z-order. See set_zsort for details.

*args, **kwargs

All other parameters are forwarded to PolyCollection.

Notes

Note that this class does a bit of magic with the _facecolors and _edgecolors properties.

__module__ = 'mpl_toolkits.mplot3d.art3d'
do_3d_projection(renderer=<deprecated parameter>)[source]

Perform the 3D projection for this object.

get_edgecolor()[source]
get_facecolor()[source]
get_vector(segments3d)[source]

Optimize points for projection.

set_3d_properties()[source]
set_alpha(alpha)[source]

Set the alpha value used for blending - not supported on all backends.

Parameters:
alphaarray-like or scalar or None

All values must be within the 0-1 range, inclusive. Masked values and nans are not supported.

set_edgecolor(colors)[source]

Set the edgecolor(s) of the collection.

Parameters:
ccolor or list of colors or 'face'

The collection edgecolor(s). If a sequence, the patches cycle through it. If 'face', match the facecolor.

set_facecolor(colors)[source]

Set the facecolor(s) of the collection. c can be a color (all patches have same color), or a sequence of colors; if it is a sequence the patches will cycle through the sequence.

If c is 'none', the patch will not be filled.

Parameters:
ccolor or list of colors
set_sort_zpos(val)[source]

Set the position to use for z-sorting.

set_verts(verts, closed=True)[source]

Set 3D vertices.

set_verts_and_codes(verts, codes)[source]

Set 3D vertices with path codes.

set_zsort(zsort)[source]

Set the calculation method for the z-order.

Parameters:
zsort{'average', 'min', 'max'}

The function applied on the z-coordinates of the vertices in the viewer's coordinate system, to determine the z-order.