I am trying to add the same instance of a patch to multiple axes in matplotlib. Here is minimal example:
import matplotlib.pyplot as mpl_plt
import matplotlib.patches as mpl_patches
fig, (axes_1, axes_2) = mpl_plt.subplots(2,1)
axes_1.axis([-5, 5, -5, 5])
axes_2.axis([-5, 5, -5, 5])
# Create ellipse and add it to the axes
ellipse = mpl_patches.Ellipse((1,1), 0.5, 0.8)
axes_1.add_patch(ellipse)
axes_2.add_patch(ellipse)
# Change the position of the ellipse
ellipse.center = (2,2)
# Show the plot
mpl_plt.show()
In this example, the ellipse does not appear in either subplot. If I comment out the line axes_2.add_patch(ellipse), the ellipse appears in the first subplot at its moved location (2,2). Is it possible to have the ellipse appear in multiple axes and have changes to it reflected in both?
My end goal is being able to add artists to different subplots and have changes to the artists reflected in all axes. Even better would be to use zoomed_inset_axes from mpl_toolkits to have an inset plot that shows a close-up of a patch, where changes to the patch would be shown in both the main plot and the inset.