8000 Merge pull request #25415 from oscargus/docs2 · matplotlib/matplotlib@298aa41 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 298aa41

Browse files
authored
Merge pull request #25415 from oscargus/docs2
Add links for path types and general improvements
2 parents 3810c29 + de6726f commit 298aa41

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

lib/matplotlib/path.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,33 @@ class Path:
3333
3434
These two arrays always have the same length in the first
3535
dimension. For example, to represent a cubic curve, you must
36-
provide three vertices and three ``CURVE4`` codes.
36+
provide three vertices and three `CURVE4` codes.
3737
3838
The code types are:
3939
40-
- ``STOP`` : 1 vertex (ignored)
40+
- `STOP` : 1 vertex (ignored)
4141
A marker for the end of the entire path (currently not required and
4242
ignored)
4343
44-
- ``MOVETO`` : 1 vertex
44+
- `MOVETO` : 1 vertex
4545
Pick up the pen and move to the given vertex.
4646
47-
- ``LINETO`` : 1 vertex
47+
- `LINETO` : 1 vertex
4848
Draw a line from the current position to the given vertex.
4949
50-
- ``CURVE3`` : 1 control point, 1 endpoint
50+
- `CURVE3` : 1 control point, 1 endpoint
5151
Draw a quadratic Bézier curve from the current position, with the given
5252
control point, to the given end point.
5353
54-
- ``CURVE4`` : 2 control points, 1 endpoint
54+
- `CURVE4` : 2 control points, 1 endpoint
5555
Draw a cubic Bézier curve from the current position, with the given
5656
control points, to the given end point.
5757
58-
- ``CLOSEPOLY`` : 1 vertex (ignored)
58+
- `CLOSEPOLY` : 1 vertex (ignored)
5959
Draw a line segment to the start point of the current polyline.
6060
61-
If *codes* is None, it is interpreted as a ``MOVETO`` followed by a series
62-
of ``LINETO``.
61+
If *codes* is None, it is interpreted as a `MOVETO` followed by a series
62+
of `LINETO`.
6363
6464
Users of Path objects should not access the vertices and codes arrays
6565
directly. Instead, they should use `iter_segments` or `cleaned` to get the
@@ -121,7 +121,7 @@ def __init__(self, vertices, codes=None, _interpolation_steps=1,
121121
If *codes* is None and closed is True, vertices will be treated as
122122
line segments of a closed polygon. Note that the last vertex will
123123
then be ignored (as the corresponding code will be set to
124-
CLOSEPOLY).
124+
`CLOSEPOLY`).
125125
readonly : bool, optional
126126
Makes the path behave in an immutable way and sets the vertices
127127
and codes as read-only arrays.
@@ -319,7 +319,7 @@ def make_compound_path_from_polys(cls, XY):
319319
@classmethod
320320
def make_compound_path(cls, *args):
321321
r"""
322-
Concatenate a list of `Path`\s into a single `.Path`, removing all `.STOP`\s.
322+
Concatenate a list of `Path`\s into a single `Path`, removing all `STOP`\s.
323323
"""
324324
if not args:
325325
return Path(np.empty([0, 2], dtype=np.float32))
@@ -412,7 +412,7 @@ def iter_segments(self, transform=None, remove_nans=True, clip=None,
412412

413413
def iter_bezier(self, **kwargs):
414414
"""
415-
Iterate over each Bézier curve (lines included) in a Path.
415+
Iterate over each Bézier curve (lines included) in a `Path`.
416416
417417
Parameters
418418
----------
@@ -421,15 +421,15 @@ def iter_bezier(self, **kwargs):
421421
422422
Yields
423423
------
424-
B : matplotlib.bezier.BezierSegment
424+
B : `~matplotlib.bezier.BezierSegment`
425425
The Bézier curves that make up the current path. Note in particular
426426
that freestanding points are Bézier curves of order 0, and lines
427427
are Bézier curves of order 1 (with two control points).
428-
code : Path.code_type
428+
code : `~matplotlib.path.Path.code_type`
429429
The code describing what kind of curve is being returned.
430-
Path.MOVETO, Path.LINETO, Path.CURVE3, Path.CURVE4 correspond to
430+
`MOVETO`, `LINETO`, `CURVE3`, and `CURVE4` correspond to
431431
Bézier curves with 1, 2, 3, and 4 control points (respectively).
432-
Path.CLOSEPOLY is a Path.LINETO with the control points correctly
432+
`CLOSEPOLY` is a `LINETO` with the control points correctly
433433
chosen based on the start/end points of the current stroke.
434434
"""
435435
first_vert = None
@@ -461,7 +461,7 @@ def cleaned(self, transform=None, remove_nans=False, clip=None,
461461
*, simplify=False, curves=False,
462462
stroke_width=1.0, snap=False, sketch=None):
463463
"""
464-
Return a new Path with vertices and codes cleaned according to the
464+
Return a new `Path` with vertices and codes cleaned according to the
465465
parameters.
466466
467467
See Also
@@ -494,14 +494,14 @@ def contains_point(self, point, transform=None, radius=0.0):
494494
Return whether the area enclosed by the path contains the given point.
495495
496496
The path is always treated as closed; i.e. if the last code is not
497-
CLOSEPOLY an implicit segment connecting the last vertex to the first
497+
`CLOSEPOLY` an implicit segment connecting the last vertex to the first
498498
vertex is assumed.
499499
500500
Parameters
501501
----------
502502
point : (float, float)
503503
The point (x, y) to check.
504-
transform : `matplotlib.transforms.Transform`, optional
504+
transform : `~matplotlib.transforms.Transform`, optional
505505
If not ``None``, *point* will be compared to ``self`` transformed
506506
by *transform*; i.e. for a correct check, *transform* should
507507
transform the path into the coordinate system of *point*.
@@ -544,14 +544,14 @@ def contains_points(self, points, transform=None, radius=0.0):
544544
Return whether the area enclosed by the path contains the given points.
545545
546546
The path is always treated as closed; i.e. if the last code is not
547-
CLOSEPOLY an implicit segment connecting the last vertex to the first
547+
`CLOSEPOLY` an implicit segment connecting t 1E79 he last vertex to the first
548548
vertex is assumed.
549549
550550
Parameters
551551
----------
552552
points : (N, 2) array
553553
The points to check. Columns contain x and y values.
554-
transform : `matplotlib.transforms.Transform`, optional
554+
transform : `~matplotlib.transforms.Transform`, optional
555555
If not ``None``, *points* will be compared to ``self`` transformed
556556
by *transform*; i.e. for a correct check, *transform* should
557557
transform the path into the coordinate system of *points*.
@@ -600,7 +600,7 @@ def get_extents(self, transform=None, **kwargs):
600600
601601
Parameters
602602
----------
603-
transform : matplotlib.transforms.Transform, optional
603+
transform : `~matplotlib.transforms.Transform`, optional
604604
Transform to apply to path before computing extents, if any.
605605
**kwargs
606606
Forwarded to `.iter_bezier`.
@@ -658,9 +658,9 @@ def intersects_bbox(self, bbox, filled=True):
658658

659659
def interpolated(self, steps):
660660
"""
661-
Return a new path resampled to length N x steps.
661+
Return a new path resampled to length N x *steps*.
662662
663-
Codes other than LINETO are not handled correctly.
663+
Codes other than `LINETO` are not handled correctly.
664664
"""
665665
if steps == 1:
666666
return self
@@ -679,7 +679,7 @@ def to_polygons(self, transform=None, width=0, height=0, closed_only=True):
679679
"""
680680
Convert this path to a list of polygons or polylines. Each
681681
polygon/polyline is an (N, 2) array of vertices. In other words,
682-
each polygon has no ``MOVETO`` instructions or curves. This
682+
each polygon has no `MOVETO` instructions or curves. This
683683
is useful for displaying in backends that do not support
684684
compound paths or Bézier curves.
685685
@@ -1016,7 +1016,7 @@ def wedge(cls, theta1, theta2, n=None):
10161016
@lru_cache(8)
10171017
def hatch(hatchpattern, density=6):
10181018
"""
1019-
Given a hatch specifier, *hatchpattern*, generates a Path that
1019+
Given a hatch specifier, *hatchpattern*, generates a `Path` that
10201020
can be used in a repeated hatching pattern. *density* is the
10211021
number of lines per unit square.
10221022
"""
@@ -1048,7 +1048,7 @@ def get_path_collection_extents(
10481048
10491049
Parameters
10501050
----------
1051-
master_transform : `.Transform`
1051+
master_transform : `~matplotlib.transforms.Transform`
10521052
Global transformation applied to all paths.
10531053
paths : list of `Path`
10541054
transforms : list of `~matplotlib.transforms.Affine2DBase`

0 commit comments

Comments
 (0)
0