Skip to content

Improve path.py docstrings a bit #20924

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
Aug 27, 2021
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
20 changes: 10 additions & 10 deletions lib/matplotlib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class Path:
The underlying storage is made up of two parallel numpy arrays:

- *vertices*: an Nx2 float array of vertices
- *codes*: an N-length uint8 array of vertex types, or None
- *codes*: an N-length uint8 array of path codes, or None

These two arrays always have the same length in the first
dimension. For example, to represent a cubic curve, you must
provide three vertices as well as three codes ``CURVE4``.
provide three vertices and three ``CURVE4`` codes.

The code types are:

Expand Down Expand Up @@ -109,7 +109,7 @@ def __init__(self, vertices, codes=None, _interpolation_steps=1,
handled correctly by the Agg PathIterator and other consumers of
path data, such as :meth:`iter_segments`.
codes : array-like or None, optional
n-length array integers representing the codes of the path.
N-length array of integers representing the codes of the path.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Capitalized to match the number of rows in vertices.

If not None, codes must be the same length as vertices.
If None, *vertices* will be treated as a series of line segments.
_interpolation_steps : int, optional
Expand Down Expand Up @@ -288,7 +288,7 @@ def make_compound_path_from_polys(cls, XY):
Make a compound path object to draw a number
of polygons with equal numbers of sides XY is a (numpolys x
numsides x 2) numpy array of vertices. Return object is a
:class:`Path`
:class:`Path`.

.. plot:: gallery/misc/histogram_path.py

Expand All @@ -314,8 +314,8 @@ def make_compound_path_from_polys(cls, XY):
@classmethod
def make_compound_path(cls, *args):
"""
Make a compound path from a list of Path objects. Blindly removes all
Path.STOP control points.
Make a compound path from a list of `Path` objects. Blindly removes
all `Path.STOP` control points.
"""
# Handle an empty list in args (i.e. no args).
if not args:
Expand Down Expand Up @@ -917,8 +917,8 @@ def unit_circle_righthalf(cls):
@classmethod
def arc(cls, theta1, theta2, n=None, is_wedge=False):
"""
Return the unit circle arc from angles *theta1* to *theta2* (in
degrees).
Return a `Path` for the unit circle arc from angles *theta1* to
*theta2* (in degrees).

*theta2* is unwrapped to produce the shortest arc within 360 degrees.
That is, if *theta2* > *theta1* + 360, the arc will be from *theta1* to
Expand Down Expand Up @@ -996,8 +996,8 @@ def arc(cls, theta1, theta2, n=None, is_wedge=False):
@classmethod
def wedge(cls, theta1, theta2, n=None):
"""
Return the unit circle wedge from angles *theta1* to *theta2* (in
degrees).
Return a `Path` for the unit circle wedge from angles *theta1* to
*theta2* (in degrees).

*theta2* is unwrapped to produce the shortest wedge within 360 degrees.
That is, if *theta2* > *theta1* + 360, the wedge will be from *theta1*
Expand Down