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

Commit662dc23

Browse files
jklymakmeeseeksmachine
authored andcommitted
Backport PRmatplotlib#17995: Avoid using Bbox machinery in Path.get_extents; special case polylines.
1 parent1dbc782 commit662dc23

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

‎lib/matplotlib/path.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,19 @@ def get_extents(self, transform=None, **kwargs):
588588
from .transformsimportBbox
589589
iftransformisnotNone:
590590
self=transform.transform_path(self)
591-
bbox=Bbox.null()
592-
forcurve,codeinself.iter_bezier(**kwargs):
593-
# places where the derivative is zero can be extrema
594-
_,dzeros=curve.axis_aligned_extrema()
595-
# as can the ends of the curve
596-
bbox.update_from_data_xy(curve([0,*dzeros,1]),ignore=False)
597-
returnbbox
591+
ifself.codesisNone:
592+
xys=self.vertices
593+
eliflen(np.intersect1d(self.codes, [Path.CURVE3,Path.CURVE4]))==0:
594+
xys=self.vertices[self.codes!=Path.CLOSEPOLY]
595+
else:
596+
xys= []
597+
forcurve,codeinself.iter_bezier(**kwargs):
598+
# places where the derivative is zero can be extrema
599+
_,dzeros=curve.axis_aligned_extrema()
600+
# as can the ends of the curve
601+
xys.append(curve([0,*dzeros,1]))
602+
xys=np.concatenate(xys)
603+
returnBbox([xys.min(axis=0),xys.max(axis=0)])
598604

599605
defintersects_path(self,other,filled=True):
600606
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp