From e92da6bd622b69e026a52d2933fe71ec8a88f2cb Mon Sep 17 00:00:00 2001 From: Bruno Beltran Date: Mon, 30 Mar 2020 14:25:09 -0700 Subject: [PATCH] backport bezier import fix without API change --- doc/api/next_api_changes/removals.rst | 2 +- lib/matplotlib/bezier.py | 9 +++++---- lib/matplotlib/path.py | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/api/next_api_changes/removals.rst b/doc/api/next_api_changes/removals.rst index c2dab6f14c5f..8d50ae6e54b8 100644 --- a/doc/api/next_api_changes/removals.rst +++ b/doc/api/next_api_changes/removals.rst @@ -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) diff --git a/lib/matplotlib/bezier.py b/lib/matplotlib/bezier.py index d82539a7f90c..b6e5edfeb2f1 100644 --- a/lib/matplotlib/bezier.py +++ b/lib/matplotlib/bezier.py @@ -7,12 +7,12 @@ import numpy as np import matplotlib.cbook as cbook -from matplotlib.path import Path class NonIntersectingPathException(ValueError): pass + # some functions @@ -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) @@ -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) @@ -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) diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index 16e77e95b45e..36eb3f13ac12 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -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) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy