【发布时间】:2014-03-14 18:17:40
【问题描述】:
Matplotlib 中的 Python 绘图:我每天同时采集许多样本,这显示了(某物的)测量值的变化。这可能显示为 2D 图(左下方),但随着样本数量的增加,我希望将此数据显示为堆叠的 3D 图(右下方图像) - 此图像仅用于说明。
作为起点,我的代码如下,我该如何实现?
import numpy as np
import pylab as plt
t = np.arange(1024)*1e-6
y1 = np.sin(t*2e3*np.pi)
y2 = 0.5*y1
y3 = 0.25*y1
plt.plot(t,y1,'k-', label='12/03/14')
plt.plot(t,y2,'r-', label='13/03/14')
plt.plot(t,y3,'b-', label='14/03/14')
plt.xlabel('Time/sample no.')
plt.ylabel('Pk-pk level (arbitrary units)')
plt.legend()
plt.grid()
plt.show()
【问题讨论】:
-
查看 matplotlib 包的 3d 功能:matplotlib.org/mpl_toolkits/mplot3d/tutorial.html
标签: python matplotlib