Skip to content

Commit e702edd

Browse files
authored
Fix bezier/path circular import without API change
1 parent 84e872d commit e702edd

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

doc/api/next_api_changes/removals.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Classes, methods and attributes
103103

104104
- ``image.BboxImage.interp_at_native`` property (no replacement)
105105
- ``lines.Line2D.verticalOffset`` property (no replacement)
106-
- ``bezier.find_r_to_boundary_of_closedpath()`` (no relacement)
106+
- ``bezier.find_r_to_boundary_of_closedpath()`` (no replacement)
107107

108108
- ``quiver.Quiver.color()`` (use ``Quiver.get_facecolor()`` instead)
109109
- ``quiver.Quiver.keyvec`` property (no replacement)

lib/matplotlib/bezier.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import numpy as np
88

99
import matplotlib.cbook as cbook
10-
from matplotlib.path import Path
1110

1211

1312
class NonIntersectingPathException(ValueError):
1413
pass
1514

15+
1616
# some functions
1717

1818

@@ -230,6 +230,7 @@ def split_path_inout(path, inside, tolerance=0.01, reorder_inout=False):
230230
Divide a path into two segments at the point where ``inside(x, y)`` becomes
231231
False.
232232
"""
233+
from .path import Path
233234
path_iter = path.iter_segments()
234235

235236
ctl_points, command = next(path_iter)
@@ -486,6 +487,7 @@ def make_path_regular(p):
486487
with ``codes`` set to (MOVETO, LINETO, LINETO, ..., LINETO); otherwise
487488
return *p* itself.
488489
"""
490+
from .path import Path
489491
c = p.codes
490492
if c is None:
491493
c = np.full(len(p.vertices), Path.LINETO, dtype=Path.code_type)
@@ -498,6 +500,5 @@ def make_path_regular(p):
498500
@cbook.deprecated("3.3", alternative="Path.make_compound_path()")
499501
def concatenate_paths(paths):
500502
"""Concatenate a list of paths into a single path."""
501-
vertices = np.concatenate([p.vertices for p in paths])
502-
codes = np.concatenate([make_path_regular(p).codes for p in paths])
503-
return Path(vertices, codes)
503+
from .path import Path
504+
return Path.make_compound_path(*paths)

lib/matplotlib/path.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,8 @@ def unit_rectangle(cls):
647647
def unit_regular_polygon(cls, numVertices):
648648
"""
649649
Return a :class:`Path` instance for a unit regular polygon with the
650-
given *numVertices* and radius of 1.0, centered at (0, 0).
650+
given *numVertices* such that the circumscribing circle has radius 1.0,
651+
centered at (0, 0).
651652
"""
652653
if numVertices <= 16:
653654
path = cls._unit_regular_polygons.get(numVertices)

0 commit comments

Comments
 (0)