mpl_toolkits.mplot3d.art3d.Poly3DCollection#
- class mpl_toolkits.mplot3d.art3d.Poly3DCollection(verts, *args, zsort='average', **kwargs)[source]#
Bases:
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 (N, 3) array-like
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.
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, sort_zpos=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, verts=<UNSET>, verts_and_codes=<UNSET>, visible=<UNSET>, zorder=<UNSET>, zsort=<UNSET>)[source]#
Set multiple properties at once.
Supported properties are
Property
Description
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
unknown
bool
antialiased
or aa or antialiasedsbool or list of bools
array-like or None
CapStyle
or {'butt', 'projecting', 'round'}(vmin: float, vmax: float)
bool
Patch or (Path, Transform) or None
Colormap
or str or Nonecolor or list of rgba tuples
edgecolor
or ec or edgecolorsunknown
facecolor
or facecolors or fcunknown
str
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
bool
JoinStyle
or {'miter', 'round', 'bevel'}object
linestyle
or dashes or linestyles or lsstr or tuple or list thereof
linewidth
or linewidths or lwfloat or list of floats
bool
Normalize
or str or Noneoffset_transform
or transOffsetunknown
(N, 2) or (2,) array-like
list of array-like
None or bool or float or callable
unknown
bool
sizes
ndarray or None
(scale: float, length: float, randomness: float)
bool or None
unknown
str
list of str or None
unknown
unknown
bool
float
{'average', 'min', 'max'}
- 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.
Examples using mpl_toolkits.mplot3d.art3d.Poly3DCollection
#
Custom hillshading in a 3D surface plot
Generate polygons to fill under 3D line graph