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

Commit8ccd2ee

Browse files
authored
Merge pull request#28490 from meeseeksmachine/auto-backport-of-pr-28486-on-v3.9.x
Backport PR#28486 on branch v3.9.x (Fix CompositeGenericTransform.contains_branch_seperately)
2 parents51decc5 +b7d25c4 commit8ccd2ee

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎lib/matplotlib/tests/test_transforms.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,13 @@ def test_contains_branch(self):
667667

668668
assertnotself.stack1.contains_branch(self.tn1+self.ta2)
669669

670+
blend=mtransforms.BlendedGenericTransform(self.tn2,self.stack2)
671+
x,y=blend.contains_branch_seperately(self.stack2_subset)
672+
stack_blend=self.tn3+blend
673+
sx,sy=stack_blend.contains_branch_seperately(self.stack2_subset)
674+
assertxissxisFalse
675+
assertyissyisTrue
676+
670677
deftest_affine_simplification(self):
671678
# tests that a transform stack only calls as much is absolutely
672679
# necessary "non-affine" allowing the best possible optimization with

‎lib/matplotlib/transforms.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ def contains_branch_seperately(self, other_transform):
14231423
'transforms with 2 output dimensions')
14241424
# for a non-blended transform each separate dimension is the same, so
14251425
# just return the appropriate shape.
1426-
return[self.contains_branch(other_transform)]*2
1426+
return(self.contains_branch(other_transform), )*2
14271427

14281428
def__sub__(self,other):
14291429
"""
@@ -2404,6 +2404,15 @@ def _iter_break_from_left_to_right(self):
24042404
forleft,rightinself._b._iter_break_from_left_to_right():
24052405
yieldself._a+left,right
24062406

2407+
defcontains_branch_seperately(self,other_transform):
2408+
# docstring inherited
2409+
ifself.output_dims!=2:
2410+
raiseValueError('contains_branch_seperately only supports '
2411+
'transforms with 2 output dimensions')
2412+
ifself==other_transform:
2413+
return (True,True)
2414+
returnself._b.contains_branch_seperately(other_transform)
2415+
24072416
depth=property(lambdaself:self._a.depth+self._b.depth)
24082417
is_affine=property(lambdaself:self._a.is_affineandself._b.is_affine)
24092418
is_separable=property(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp