Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9214657

Browse files
committed
BUGFIX: Bbox union and transform, better semantics
1 parent 6253d80 commit 9214657

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/matplotlib/transforms.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,10 @@ def union(bboxes):
660660
# needed for 1.14.4 < numpy_version < 1.16
661661
# can remove once we are at numpy >= 1.16
662662
with np.errstate(invalid='ignore'):
663-
x0 = np.min([bbox.xmin for bbox in bboxes])
664-
x1 = np.max([bbox.xmax for bbox in bboxes])
665-
y0 = np.min([bbox.ymin for bbox in bboxes])
666-
y1 = np.max([bbox.ymax for bbox in bboxes])
663+
x0 = np.min([bbox.x0 for bbox in bboxes])
664+
x1 = np.max([bbox.x1 for bbox in bboxes])
665+
y0 = np.min([bbox.y0 for bbox in bboxes])
666+
y1 = np.max([bbox.y1 for bbox in bboxes])
667667
return Bbox([[x0, y0], [x1, y1]])
668668

669669
@staticmethod
@@ -672,10 +672,10 @@ def intersection(bbox1, bbox2):
672672
Return the intersection of *bbox1* and *bbox2* if they intersect, or
673673
None if they don't.
674674
"""
675-
x0 = np.maximum(bbox1.xmin, bbox2.xmin)
676-
x1 = np.minimum(bbox1.xmax, bbox2.xmax)
677-
y0 = np.maximum(bbox1.ymin, bbox2.ymin)
678-
y1 = np.minimum(bbox1.ymax, bbox2.ymax)
675+
x0 = np.maximum(bbox1.x0, bbox2.x0)
676+
x1 = np.minimum(bbox1.x1, bbox2.x1)
677+
y0 = np.maximum(bbox1.y0, bbox2.y0)
678+
y1 = np.minimum(bbox1.y1, bbox2.y1)
679679
return Bbox([[x0, y0], [x1, y1]]) if x0 <= x1 and y0 <= y1 else None
680680

681681

0 commit comments

Comments
 (0)