Skip to content

Commit 9f3ac12

Browse files
committed
Document filling of Poly3DCollection
1 parent 64ae323 commit 9f3ac12

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

lib/mpl_toolkits/mplot3d/art3d.py

+28-6
Original file line numberDiff line numberDiff line change
@@ -530,17 +530,39 @@ def patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True):
530530
class Poly3DCollection(PolyCollection):
531531
"""
532532
A collection of 3D polygons.
533+
534+
.. note::
535+
**Filling of 3D polygons**
536+
537+
There is no simple definition of the enclosed surface of a 3D polygon
538+
unless the polygon is planar.
539+
540+
In practice, Matplotlib performs the filling on the 2D projection of
541+
the polygon. This gives a correct filling appearance only for planar
542+
polygons. For all other polygons, you'll find orientations in which
543+
the edges of the polygon intersect in the projection. This will lead
544+
to an incorrect visualization of the 3D area.
545+
546+
If you need filled areas, it is recommended to create them via
547+
`.plot_trisurf`, which creates a triangulation and thus generates
548+
consistent surfaces.
533549
"""
534550

535551
def __init__(self, verts, *args, zsort='average', **kwargs):
536552
"""
537-
Create a Poly3DCollection.
538-
539-
*verts* should contain 3D coordinates.
540-
541-
Keyword arguments:
542-
zsort, see set_zsort for options.
553+
Parameters
554+
----------
555+
verts : list of array-like Nx3
556+
Each element describes a polygon as a sequnce of ``N_i`` points
557+
``(x, y, z)``.
558+
zsort : {'average', 'min', 'max'}, default: 'average'
559+
The calculation method for the z-order.
560+
See `~.Poly3DCollection.set_zsort` for details.
561+
*args, **kwargs
562+
All other parameters are forwarded to `.PolyCollection`.
543563
564+
Notes
565+
-----
544566
Note that this class does a bit of magic with the _facecolors
545567
and _edgecolors properties.
546568
"""

0 commit comments

Comments
 (0)