Closed
Description
Bug report
Bug summary
inset_locator.mark_inset()
sometimes misplaces the box connector lines if x/y limits on the parent Axes
have not been explicitly set. Updating the plot (e.g. by saving the figure) seems to fix it.
Code for reproduction
import matplotlib.pyplot as plt
import mpl_toolkits.axes_grid1.inset_locator as miloc
fig, (inset, full) = plt.subplots(ncols=2)
# swapping the axes makes the example work
# full, inset = inset, full
full.plot([-1, 0], [-1, 0])
inset.set_xlim(-0.6, -0.4)
inset.set_ylim(-0.6, -0.4)
# workaround
# full.set_xlim(-1.0, 0.0)
# full.set_ylim(-1.0, 0.0)
miloc.mark_inset(full, inset, 1, 4)
fig.savefig('Bug.png')
# saving the figure a second time produces the expected result
fig.savefig('NoBug.png')
Actual outcome
Expected outcome
This issue was not present in version 3.0.2.
Matplotlib version
- Operating system: Fedora and Debian
- Matplotlib version: 3.2.1 and 3.2.2
- Matplotlib backend (
print(matplotlib.get_backend())
):Qt5Agg
andagg
- Python version: 3.8
- Jupyter version (if applicable): N/A
- Other libraries: N/A
Installed via pip on Debian and both pip and dnf on Fedora.