Skip to content

Bezier/Path API Cleanup: fix circular import issue #16812

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 31, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion doc/api/next_api_changes/removals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Classes, methods and attributes

- ``image.BboxImage.interp_at_native`` property (no replacement)
- ``lines.Line2D.verticalOffset`` property (no replacement)
- ``bezier.find_r_to_boundary_of_closedpath()`` (no relacement)
- ``bezier.find_r_to_boundary_of_closedpath()`` (no replacement)

- ``quiver.Quiver.color()`` (use ``Quiver.get_facecolor()`` instead)
- ``quiver.Quiver.keyvec`` property (no replacement)
Expand Down
9 changes: 5 additions & 4 deletions lib/matplotlib/bezier.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import numpy as np

import matplotlib.cbook as cbook
from matplotlib.path import Path


class NonIntersectingPathException(ValueError):
pass


# some functions


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

ctl_points, command = next(path_iter)
Expand Down Expand Up @@ -486,6 +487,7 @@ def make_path_regular(p):
with ``codes`` set to (MOVETO, LINETO, LINETO, ..., LINETO); otherwise
return *p* itself.
"""
from .path import Path
c = p.codes
if c is None:
c = np.full(len(p.vertices), Path.LINETO, dtype=Path.code_type)
Expand All @@ -498,6 +500,5 @@ def make_path_regular(p):
@cbook.deprecated("3.3", alternative="Path.make_compound_path()")
def concatenate_paths(paths):
"""Concatenate a list of paths into a single path."""
vertices = np.concatenate([p.vertices for p in paths])
codes = np.concatenate([make_path_regular(p).codes for p in paths])
return Path(vertices, codes)
from .path import Path
return Path.make_compound_path(*paths)
3 changes: 2 additions & 1 deletion lib/matplotlib/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,8 @@ def unit_rectangle(cls):
def unit_regular_polygon(cls, numVertices):
"""
Return a :class:`Path` instance for a unit regular polygon with the
given *numVertices* and radius of 1.0, centered at (0, 0).
given *numVertices* such that the circumscribing circle has radius 1.0,
centered at (0, 0).
"""
if numVertices <= 16:
path = cls._unit_regular_polygons.get(numVertices)
Expand Down