It seems to be based on the default construction of MATLAB , for which you need to call hold on to add more than one chart to the same chart. The default behavior for matplotlib seems to be true, consider
import numpy as np import matplotlib.pyplot as plt x=np.linspace(0,np.pi*2,1000) plt.plot(x,np.sin(x),hold=True) plt.plot(x,np.sin(x)**2,hold=True) plt.show()

which displays both lines on the same chart. If the hold is set to false, the next plot call overwrites the previous one. For example,
import numpy as np import matplotlib.pyplot as plt x=np.linspace(0,np.pi*2,1000) plt.plot(x,np.sin(x),hold=True) plt.plot(x,np.sin(x)**2,hold=False) plt.show()

Ed smith
source share