MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / intersection

Method intersection

lib/matplotlib/transforms.py:677–686  ·  view source on GitHub ↗

Return the intersection of *bbox1* and *bbox2* if they intersect, or None if they don't.

(bbox1, bbox2)

Source from the content-addressed store, hash-verified

675
676 @staticmethod
677 def intersection(bbox1, bbox2):
678 """
679 Return the intersection of *bbox1* and *bbox2* if they intersect, or
680 None if they don't.
681 """
682 x0 = np.maximum(bbox1.xmin, bbox2.xmin)
683 x1 = np.minimum(bbox1.xmax, bbox2.xmax)
684 y0 = np.maximum(bbox1.ymin, bbox2.ymin)
685 y1 = np.minimum(bbox1.ymax, bbox2.ymax)
686 return Bbox([[x0, y0], [x1, y1]]) if x0 <= x1 and y0 <= y1 else None
687
688
689_default_minpos = np.array([np.inf, np.inf])

Callers 6

__init__Method · 0.80
mark_insetFunction · 0.80
_make_imageMethod · 0.80
get_tightbboxMethod · 0.80
bar_labelMethod · 0.80

Calls 1

BboxClass · 0.85

Tested by

no test coverage detected