I want to plot a sin-function and show it, then add a cos-function and plot again, so that the output is two plots, the first with only sin and the second with sin AND cos. But show() flushes the plot, how do I prevent the flushing?
import numpy as np
import matplotlib.pyplot as plt
f1 = lambda x: np.sin(x)
f2 = lambda x: np.cos(x)
x = np.linspace(1,7,100)
y1 = f1(x)
y2 = f2(x)
plt.plot(x,y1)
plt.show() #can I avoid flushing here?
plt.plot(x,y2)
plt.show()
I need it in a jupyter notebook.