在Matlab的hold on
的matplotlib中是否有顯式的等價命令?我試圖在同一軸上繪製所有的圖形。一些圖表是一個for
循環中產生的,而這些都是從su
和sl
分別畫在:相當於在Matlab中保留的Python
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()
你的意思是'plt.hold(True)'? –
[多重圖中一個蟒蛇圖]可能的重複(http://stackoverflow.com/questions/21254472/multiple-plot-in-one-figure-in-python/21254861) – Kraay89
@ Cody Piersall - 它可能適用於其他人,但顯然不適合我的例子。 –