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

Commit21a2ade

Browse files
committed
deprecate bezier functions instead of removing
1 parent9017f21 commit21a2ade

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

‎doc/api/next_api_changes/deprecations.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,10 @@ mathtext ``Glue`` helper classes
370370
The ``Fil``, ``Fill``, ``Filll``, ``NegFil``, ``NegFill``, ``NegFilll``, and
371371
``SsGlue`` classes in the:mod:`matplotlib.mathtext` module are deprecated.
372372
As an alternative, directly construct glue instances with ``Glue("fil")``, etc.
373+
374+
Various `matplotlib.bezier` methods that belonged in `.Path` moved there
375+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
376+
- ``bezier.inside_circle()`` (no replacement)
377+
- ``bezier.split_path_inout`` (use ``Path.split_path_inout`` instead)
378+
- ``bezier.make_path_regular`` (use ``Path.make_path_regular`` instead)
379+
- ``bezier.concatenate_paths`` (use ``Path.make_compound_path`` instead)

‎doc/api/next_api_changes/removals.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ Classes and methods
8585
- ``image.BboxImage.interp_at_native`` property (no replacement)
8686
- ``lines.Line2D.verticalOffset`` property (no replacement)
8787
- ``bezier.find_r_to_boundary_of_closedpath()`` (no replacement)
88-
- ``bezier.inside_circle()`` (no replacement)
89-
- ``bezier.split_path_inout`` (use ``Path.split_path_inout`` instead)
90-
- ``bezier.make_path_regular`` (use ``Path.make_path_regular`` instead)
91-
- ``bezier.concatenate_paths`` (use ``Path.make_compound_path`` instead)
9288

9389
- ``quiver.Quiver.color()`` (use ``Quiver.get_facecolor()`` instead)
9490
- ``quiver.Quiver.keyvec`` property (no replacement)

‎lib/matplotlib/bezier.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,61 @@ def get_normal_points(cx, cy, cos_t, sin_t, length):
6868
returnx1,y1,x2,y2
6969

7070

71+
# deprecated routines (moved to `.Path`)
72+
73+
74+
@cbook.deprecated("3.3")
75+
definside_circle(cx,cy,r):
76+
"""
77+
Return a function that checks whether a point is in a circle with center
78+
(*cx*, *cy*) and radius *r*.
79+
80+
The returned function has the signature::
81+
82+
f(xy: Tuple[float, float]) -> bool
83+
"""
84+
r2=r**2
85+
86+
def_f(xy):
87+
x,y=xy
88+
return (x-cx)**2+ (y-cy)**2<r2
89+
return_f
90+
91+
92+
defsplit_path_inout(path,inside,tolerance=0.01,reorder_inout=False):
93+
"""
94+
Divide a path into two segments at the point where ``inside(x, y)``
95+
becomes False.
96+
"""
97+
cbook.warn_deprecated("3.3",
98+
message="split_path_inout is now a method of "
99+
"`matplotlib.path.Path`")
100+
returnpath.split_path_inout(inside,tolerance,reorder_inout)
101+
102+
103+
defmake_path_regular(path):
104+
"""
105+
If the ``codes`` attribute of `.Path` *p* is None, return a copy of *p*
106+
with ``codes`` set to (MOVETO, LINETO, LINETO, ..., LINETO); otherwise
107+
return *p* itself.
108+
"""
109+
cbook.warn_deprecated("3.3",
110+
message="make_path_regular is now a method of "
111+
"`matplotlib.path.Path`")
112+
returnpath.make_path_regular()
113+
114+
115+
defconcatenate_paths(paths):
116+
"""Concatenate a list of paths into a single path."""
117+
cbook.warn_deprecated("3.3",
118+
message="concatenate_paths is deprecated, please "
119+
"use `matplotlib.path.Path.concatenate_paths` "
120+
"instead, which correctly respects subclasses.")
121+
vertices=np.concatenate([p.verticesforpinpaths])
122+
codes=np.concatenate([make_path_regular(p).codesforpinpaths])
123+
returnPath(vertices,codes)
124+
125+
71126
# BEZIER routines
72127

73128
# subdividing bezier curve

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp