Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Deprecate Path helpers in bezier.py#14199

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 1 commit intomatplotlib:masterfromanntzer:pathconcatenator
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes fromall 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
10 changes: 10 additions & 0 deletionsdoc/api/next_api_changes/deprecations.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,3 +376,13 @@ NavigationToolbar2QT.parent
This attribute is deprecated. In order to access the parent window, use
``toolbar.canvas.parent()``. Once the deprecation period is elapsed, it will
also be accessible as ``toolbar.parent()``.

Path helpers in :mod:`.bezier`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``bezier.make_path_regular`` is deprecated. Use ``Path.cleaned()`` (or
``Path.cleaned(curves=True)``, etc.) instead (but note that these methods add a
``STOP`` code at the end of the path).

``bezier.concatenate_paths`` is deprecated. Use ``Path.make_compound_path()``
instead.
3 changes: 3 additions & 0 deletionslib/matplotlib/bezier.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -480,6 +480,8 @@ def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
return path_left, path_right


@cbook.deprecated(
"3.2", alternative="Path.cleaned() and remove the final STOP if needed")
def make_path_regular(p):
"""
If the ``codes`` attribute of `.Path` *p* is None, return a copy of *p*
Expand All@@ -495,6 +497,7 @@ def make_path_regular(p):
return p


@cbook.deprecated("3.2", 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])
Expand Down
16 changes: 6 additions & 10 deletionslib/matplotlib/patches.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,10 +10,9 @@
import matplotlib as mpl
from . import artist, cbook, colors, docstring, lines as mlines, transforms
from .bezier import (
NonIntersectingPathException, concatenate_paths, get_cos_sin,
get_intersection, get_parallels, inside_circle, make_path_regular,
make_wedged_bezier2, split_bezier_intersecting_with_closedpath,
split_path_inout)
NonIntersectingPathException, get_cos_sin, get_intersection,
get_parallels, inside_circle, make_wedged_bezier2,
split_bezier_intersecting_with_closedpath, split_path_inout)
from .path import Path


Expand DownExpand Up@@ -2873,8 +2872,6 @@ def __call__(self, path, mutation_size, linewidth,
and takes care of the aspect ratio.
"""

path = make_path_regular(path)

if aspect_ratio is not None:
# Squeeze the given height by the aspect_ratio
vertices = path.vertices / [1, aspect_ratio]
Expand All@@ -2886,10 +2883,9 @@ def __call__(self, path, mutation_size, linewidth,
if np.iterable(fillable):
path_list = []
for p in zip(path_mutated):
v, c = p.vertices, p.codes
# Restore the height
v[:, 1] = v[:, 1] * aspect_ratio
path_list.append(Path(v, c))
path_list.append(
Path(p.vertices * [1, aspect_ratio], p.codes))
return path_list, fillable
else:
return path_mutated, fillable
Expand DownExpand Up@@ -4125,7 +4121,7 @@ def get_path(self):
"""
_path, fillable = self.get_path_in_displaycoord()
if np.iterable(fillable):
_path =concatenate_paths(_path)
_path =Path.make_compound_path(*_path)
return self.get_transform().inverted().transform_path(_path)

def get_path_in_displaycoord(self):
Expand Down
5 changes: 1 addition & 4 deletionslib/matplotlib/tests/test_artist.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -100,10 +100,7 @@ def test_clipping():
exterior.vertices -= 2
interior = mpath.Path.unit_circle().deepcopy()
interior.vertices = interior.vertices[::-1]
clip_path = mpath.Path(vertices=np.concatenate([exterior.vertices,
interior.vertices]),
codes=np.concatenate([exterior.codes,
interior.codes]))
clip_path = mpath.Path.make_compound_path(exterior, interior)

star = mpath.Path.unit_regular_star(6).deepcopy()
star.vertices *= 2.6
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp