#画图的基本命令
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='red',label='sin(x)')
plt.legend()
plt.xlabel("x-axis")
plt.ylabel("y-axis")
plt.xlim(0,11)
plt.ylim(-1,1)
plt.grid(ls=":",c='b',)#打开坐标网格
plt.title("y=sin(x)")
plt.axhline(y=0,ls=":",c="yellow")#添加水平直线
plt.axvline(x=4,ls="-",c="green")#添加垂直直线
plt.show()

相关文章:

  • 2021-11-20
  • 2021-05-10
  • 2022-12-23
  • 2021-05-01
  • 2021-12-13
猜你喜欢
  • 2022-12-23
  • 2022-01-17
  • 2022-01-05
  • 2021-08-22
  • 2021-05-11
  • 2021-06-22
  • 2022-12-23
相关资源
相似解决方案