Skip to content

Document filling of Poly3DCollection #16648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions lib/mpl_toolkits/mplot3d/art3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,17 +530,39 @@ def patch_collection_2d_to_3d(col, zs=0, zdir='z', depthshade=True):
class Poly3DCollection(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 performs the filling on 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
`~mpl_toolkits.mplot3d.axes3d.Axes3D.plot_trisurf`, which creates a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just write .Axes3D.plot_trisurf (or ~.Axes3D.plot_trisurf).
Can self-merge with or without that change.

triangulation and thus generates consistent surfaces.
"""

def __init__(self, verts, *args, zsort='average', **kwargs):
"""
Create a Poly3DCollection.

*verts* should contain 3D coordinates.

Keyword arguments:
zsort, see set_zsort for options.
Parameters
----------
verts : list of array-like Nx3
Each element describes a polygon as a sequnce of ``N_i`` points
``(x, y, z)``.
zsort : {'average', 'min', 'max'}, default: 'average'
The calculation method for the z-order.
See `~.Poly3DCollection.set_zsort` for details.
*args, **kwargs
All other parameters are forwarded to `.PolyCollection`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does . mean at the beginning of a reference? Is this a sphinx thing, or something specific to matplotlib?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a "sphinx thing". But there is documentation on it in the matplotlib dev guide: https://matplotlib.org/devdocs/devel/documenting_mpl.html#referring-to-other-code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Notes
-----
Note that this class does a bit of magic with the _facecolors
and _edgecolors properties.
"""
Expand Down