Closed
Description
Method overlaps(other) from matplotlib.transforms.BboxBase returns True when checked against Bbox with NaN vertices.
# Take two bboxes with real-valued vertices which do not overlap
# By setting one bbox's vertices to np.nan, the bbox's then overlap.
import numpy as np
import matplotlib.pyplot as plt
plt.close(); plt.clf()
fig, ax = plt.subplots(1)
ax.plot(range(10), range(10))
fig.canvas.draw()
bbox1 = ax.get_xticklabels()[0].get_window_extent()
bbox2 = ax.get_xticklabels()[1].get_window_extent()
print('Overlap before nan values', bbox1.overlaps(bbox2))
overlap = bbox2.set_points(np.array([[np.nan, np.nan], [np.nan, np.nan]]))
print('Overlap after nan values', bbox1.overlaps(bbox2))
[TAC edit markup]