Skip to content

Commit a4bb9d3

Browse files
authored
Merge pull request #16763 from meeseeksmachine/auto-backport-of-pr-16648-on-v3.2.x
Backport PR #16648 on branch v3.2.x (Document filling of Poly3DCollection)
2 parents ae85a8c + 6882b72 commit a4bb9d3

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
@@ -580,17 +580,39 @@ def patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True):
580580
class Poly3DCollection(PolyCollection):
581581
"""
582582
A collection of 3D polygons.
583+
584+
.. note::
585+
**Filling of 3D polygons**
586+
587+
There is no simple definition of the enclosed surface of a 3D polygon
588+
unless the polygon is planar.
589+
590+
In practice, Matplotlib performs the filling on the 2D projection of
591+
the polygon. This gives a correct filling appearance only for planar
592+
polygons. For all other polygons, you'll find orientations in which
593+
the edges of the polygon intersect in the projection. This will lead
594+
to an incorrect visualization of the 3D area.
595+
596+
If you need filled areas, it is recommended to create them via
597+
`~mpl_toolkits.mplot3d.axes3d.Axes3D.plot_trisurf`, which creates a
598+
triangulation and thus generates consistent surfaces.
583599
"""
584600

585601
def __init__(self, verts, *args, zsort='average', **kwargs):
586602
"""
587-
Create a Poly3DCollection.
588-
589-
*verts* should contain 3D coordinates.
590-
591-
Keyword arguments:
592-
zsort, see set_zsort for options.
603+
Parameters
604+
----------
605+
verts : list of array-like Nx3
606+
Each element describes a polygon as a sequnce of ``N_i`` points
607+
``(x, y, z)``.
608+
zsort : {'average', 'min', 'max'}, default: 'average'
609+
The calculation method for the z-order.
610+
See `~.Poly3DCollection.set_zsort` for details.
611+
*args, **kwargs
612+
All other parameters are forwarded to `.PolyCollection`.
593613
614+
Notes
615+
-----
594616
Note that this class does a bit of magic with the _facecolors
595617
and _edgecolors properties.
596618
"""

0 commit comments

Comments
 (0)