One way to do this is to use the class to set all user preferences for the artist. I made an example class that has a default value for each property. If you then simply make a reference to the artistic function of this class, each time you get a new instance, but with exactly the same parameters. Notice how I changed Ellipse1 to have xy = (2,2), and this appeared on both graphs. Just for added talent, I did this so you can name more than one type of patch using getattr. Does this suggest that there are common arguments for different patches or? You can make it complicated or simple as you like, I suppose.
import matplotlib.pyplot as mpl_plt import matplotlib.patches as mpl_patches class artist_instance: def __init__(self, xy=None, width=None, height=None, type=None, ): self.xy=xy if xy is not None else (1,1) self.width=width if width is not None else 0.5 self.height=height if height is not None else 0.8 self.type=type if type is not None else 'Ellipse' def art(self): return getattr(mpl_patches,self.type)(xy=self.xy,width=self.width,height=self.height) Ellipse1=artist_instance(xy=(2,2)) fig, (axes_1, axes_2) = mpl_plt.subplots(2,1) axes_1.axis([-5, 5, -5, 5]) axes_2.axis([-5, 5, -5, 5]) axes_1.add_patch(Ellipse1.art()) axes_2.add_patch(Ellipse1.art()) mpl_plt.show()
Graph result
Samwise
source share