I have a simple base plot generated by the following code:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [1, 2, 3], label="basic plot")
Moreover, I have several additional plots that I would like each one of them to be plotted over the basic plot above, but separately. For example, if I call the above plot "basic plot", and I also have plots "additional_1" and "additional_2", then I would like to get two final plots:
- basic plot + additional_1
- basic plot + additional_2
I could of course finish with the first plot (1.), and then re-generate "basic plot", and plot "additional_2" over it, but since the creation of "basic plot" is more complex than the example described, I would like to avoid it, that is, I don't want to create the base plot multiple times.
Is there a way to plot the basic plot, and then "copy" it to multiple figs, and plot the additional figs separately on each fig? Is there any other way to achieve the same? If not, is it possible to "undo" the last (additional_1) plot, and to plot another (additional_2) instead (after saving or showing the fig)?
Here is some toy code for the additional plots: (I don't want them to be plotted together)
plt.plot([1.5, 2, 2.5], [0, 5, 2], label="additional_1")
plt.plot([2, 2.5, 3], [6, 0, 3], label="additional_2")
Thanks