Closed
Description
import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(1, 2, True, False)
x1 = [1, 2, 3, 4, 5, 6, 7, 8, 9]
y1 = [x*x for x in x1]
ax1.plot(x1, y1)
x2=y2=[]
ax2.plot(x2, y2)
plt.show()
Now ax1.get_xlim() returns erroneous (-0.06, 0.06) because when bounding boxes of two plots are united, infinitely small bounding box of ax2 (Bbox('array([[ inf, inf],\n [-inf, -inf]])')) is considered infinitely large in transforms.BboxBase.union(). E. g. transforms.BboxBase.union([ax1.dataLim, ax2.dataLim]) returns Bbox('array([[-inf, -inf],\n [ inf, inf]])') which is incorrect.
This bug prevents correct display of two plots with shared axis while one of them has empty data.
Metadata
Metadata
Assignees
Labels
No labels