数据可视化之matplotlib实战:plt.step() 绘制阶梯图
import matplotlib.pyplot as pltimport numpy as npx = np.linspace(1,10,10)y = np.sin(x)plt.step(x,y,color="#8dd3c7", where="pre",lw=2)plt.xlim(0,11)plt.xticks(np.arange(1,11,1))plt.ylim(-1.2,1.2)plt.sh
·
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(1,10,10)
y = np.sin(x)
plt.step(x,y,color="#8dd3c7", where="pre",lw=2)
plt.xlim(0,11)
plt.xticks(np.arange(1,11,1))
plt.ylim(-1.2,1.2)
plt.show()
更多推荐
已为社区贡献18条内容
所有评论(0)