Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5b2b468

Browse files
committed
Cleanup path.py docstrings.
1 parent cc7c347 commit 5b2b468

File tree

1 file changed

+31
-33
lines changed

1 file changed

+31
-33
lines changed

lib/matplotlib/path.py

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,58 +20,58 @@
2020

2121
class Path(object):
2222
"""
23-
:class:`Path` represents a series of possibly disconnected,
24-
possibly closed, line and curve segments.
23+
A series of possibly disconnected, possibly closed, line and curve
24+
segments.
2525
2626
The underlying storage is made up of two parallel numpy arrays:
27-
- *vertices*: an Nx2 float array of vertices
28-
- *codes*: an N-length uint8 array of vertex types
27+
28+
- *vertices*: an Nx2 float array of vertices
29+
- *codes*: an N-length uint8 array of vertex types, or None
2930
3031
These two arrays always have the same length in the first
3132
dimension. For example, to represent a cubic curve, you must
3233
provide three vertices as well as three codes ``CURVE3``.
3334
3435
The code types are:
3536
36-
- ``STOP`` : 1 vertex (ignored)
37-
A marker for the end of the entire path (currently not
38-
required and ignored)
37+
- ``STOP`` : 1 vertex (ignored)
38+
A marker for the end of the entire path (currently not required and
39+
ignored)
40+
41+
- ``MOVETO`` : 1 vertex
42+
Pick up the pen and move to the given vertex.
3943
40-
- ``MOVETO`` : 1 vertex
41-
Pick up the pen and move to the given vertex.
44+
- ``LINETO`` : 1 vertex
45+
Draw a line from the current position to the given vertex.
4246
43-
- ``LINETO`` : 1 vertex
44-
Draw a line from the current position to the given vertex.
47+
- ``CURVE3`` : 1 control point, 1 endpoint
48+
Draw a quadratic Bezier curve from the current position, with the given
49+
control point, to the given end point.
4550
46-
- ``CURVE3`` : 1 control point, 1 endpoint
47-
Draw a quadratic Bezier curve from the current position,
48-
with the given control point, to the given end point.
51+
- ``CURVE4`` : 2 control points, 1 endpoint
52+
Draw a cubic Bezier curve from the current position, with the given
53+
control points, to the given end point.
4954
50-
- ``CURVE4`` : 2 control points, 1 endpoint
51-
Draw a cubic Bezier curve from the current position, with
52-
the given control points, to the given end point.
55+
- ``CLOSEPOLY`` : 1 vertex (ignored)
56+
Draw a line segment to the start point of the current polyline.
5357
54-
- ``CLOSEPOLY`` : 1 vertex (ignored)
55-
Draw a line segment to the start point of the current
56-
polyline.
58+
If *codes* is None, it is interpreted as a ``MOVETO`` followed by a series
59+
of ``LINETO``.
5760
58-
Users of Path objects should not access the vertices and codes
59-
arrays directly. Instead, they should use :meth:`iter_segments`
60-
or :meth:`cleaned` to get the vertex/code pairs. This is important,
61-
since many :class:`Path` objects, as an optimization, do not store a
62-
*codes* at all, but have a default one provided for them by
63-
:meth:`iter_segments`.
61+
Users of Path objects should not access the vertices and codes arrays
62+
directly. Instead, they should use `iter_segments` or `cleaned` to get the
63+
vertex/code pairs. This helps, in particular, to consistently handle the
64+
case of *codes* being None.
6465
65-
Some behavior of Path objects can be controlled by rcParams. See
66-
the rcParams whose keys contain 'path.'.
66+
Some behavior of Path objects can be controlled by rcParams. See the
67+
rcParams whose keys start with 'path.'.
6768
6869
.. note::
6970
7071
The vertices and codes arrays should be treated as
7172
immutable -- there are a number of optimizations and assumptions
7273
made up front in the constructor that will not change when the
7374
data changes.
74-
7575
"""
7676

7777
code_type = np.uint8
@@ -496,8 +496,7 @@ def contains_path(self, path, transform=None):
496496

497497
def get_extents(self, transform=None):
498498
"""
499-
Returns the extents (*xmin*, *ymin*, *xmax*, *ymax*) of the
500-
path.
499+
Returns the extents (*xmin*, *ymin*, *xmax*, *ymax*) of the path.
501500
502501
Unlike computing the extents on the *vertices* alone, this
503502
algorithm will take into account the curves and deal with
@@ -524,8 +523,7 @@ def intersects_path(self, other, filled=True):
524523

525524
def intersects_bbox(self, bbox, filled=True):
526525
"""
527-
Returns *True* if this path intersects a given
528-
:class:`~matplotlib.transforms.Bbox`.
526+
Returns whether this path intersects a given `~.transforms.Bbox`.
529527
530528
*filled*, when True, treats the path as if it was filled.
531529
That is, if the path completely encloses the bounding box,

0 commit comments

Comments
 (0)