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

Commitfcc8f45

Browse files
committed
Deprecate Path helpers in bezier.py
... in favor of the corresponding ones in path.py.(Strictly speaking, `make_path_regular` is closed to`cleaned(remove_nans=False)` but in practice `cleaned()` works equallywell.)
1 parenta4d82fe commitfcc8f45

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Deprecations
2+
````````````
3+
4+
``bezier.make_path_regular`` is deprecated. Use ``Path.cleaned()`` (or
5+
``Path.cleaned(curves=True)``, etc.) instead.
6+
7+
``bezier.concatenate_paths`` is deprecated. Use ``Path.make_compound_path()``
8+
instead.

‎lib/matplotlib/bezier.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
457457
returnpath_left,path_right
458458

459459

460+
@cbook.deprecated("3.2",alternative="Path.cleaned()")
460461
defmake_path_regular(p):
461462
"""
462463
If the :attr:`codes` attribute of `Path` *p* is None, return a copy of *p*
@@ -472,6 +473,7 @@ def make_path_regular(p):
472473
returnp
473474

474475

476+
@cbook.deprecated("3.2",alternative="Path.make_compound_path()")
475477
defconcatenate_paths(paths):
476478
"""Concatenate a list of paths into a single path."""
477479
vertices=np.concatenate([p.verticesforpinpaths])

‎lib/matplotlib/patches.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,7 +3223,7 @@ def __call__(self, path, mutation_size, linewidth,
32233223
and takes care of the aspect ratio.
32243224
"""
32253225

3226-
path=make_path_regular(path)
3226+
path=path.cleaned(curves=True)
32273227

32283228
ifaspect_ratioisnotNone:
32293229
# Squeeze the given height by the aspect_ratio
@@ -4255,7 +4255,8 @@ def get_path(self):
42554255
_path,fillable=self.get_path_in_displaycoord()
42564256

42574257
ifnp.iterable(fillable):
4258-
_path=concatenate_paths(_path)
4258+
cleaned= [p.cleaned()forpin_path]
4259+
_path=Path.make_compound_path(*cleaned)
42594260

42604261
returnself.get_transform().inverted().transform_path(_path)
42614262

‎lib/matplotlib/tests/test_artist.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ def test_clipping():
101101
exterior.vertices-=2
102102
interior=mpath.Path.unit_circle().deepcopy()
103103
interior.vertices=interior.vertices[::-1]
104-
clip_path=mpath.Path(vertices=np.concatenate([exterior.vertices,
105-
interior.vertices]),
106-
codes=np.concatenate([exterior.codes,
107-
interior.codes]))
104+
clip_path=mpath.Path.make_compound_path(exterior,interior)
108105

109106
star=mpath.Path.unit_regular_star(6).deepcopy()
110107
star.vertices*=2.6

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp