Python equivalent to 'hold on' in Matlab
作者:互联网
Python equivalent to 'hold on' in Matlab - Stack Overflow
Is there an explicit equivalent command in Python's matplotlib for Matlab's hold on
? I'm trying to plot all my graphs on the same axes. Some graphs are generated inside a for
loop, and these are plotted separately from su
and sl
:
import numpy as np
import matplotlib.pyplot as plt
for i in np.arange(1,5):
z = 68 + 4 * np.random.randn(50)
zm = np.cumsum(z) / range(1,len(z)+1)
plt.plot(zm)
plt.axis([0,50,60,80])
plt.show()
n = np.arange(1,51)
su = 68 + 4 / np.sqrt(n)
sl = 68 - 4 / np.sqrt(n)
plt.plot(n,su,n,sl)
plt.axis([0,50,60,80])
plt.show()
标签:plot,plt,Python,equivalent,68,Matlab,np,hold 来源: https://www.cnblogs.com/yibeimingyue/p/16293749.html