数据可视化之matplotlib实战:plt.axhline() axvline()函数 绘制水平or垂直参考线
import matplotlib.pyplot as pltimport numpy as npx = np.linspace(0.05,10,1000)y = np.sin(x)plt.plot(x,y,ls="-.",lw=2,c="c",label="plot figure")plt.legend()plt.axhline(y=0.0,c="r",ls="--",lw=2)plt.axvl
·
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0.05,10,1000)
y = np.sin(x)
plt.plot(x,y,ls="-.",lw=2,c="c",label="plot figure")
plt.legend()
plt.axhline(y=0.0,c="r",ls="--",lw=2)
plt.axvline(x=4.0,c="r",ls="--",lw=2)
plt.show()
更多推荐
已为社区贡献18条内容
所有评论(0)