import numpy as np
import matplotlib.pyplot as plt
t = np.arange (0.0, 2.0, 0.01) # x轴上的点,0到2之间以0.01为间隔
s = np.sin (2 * np.pi * t) # y轴为正弦
plt.plot (t, s) # 画图
plt.xlabel ('time (s)') # x轴标签
plt.ylabel ('voltage (mV)') # y轴标签
plt.title ('About as simple as it gets, folks') # 图的标签
plt.grid (True) # 产生网格
plt.savefig ("test.png") # 保存图像
plt.show () # 显示图像
python 基础图
于 2023-03-17 21:09:38 首次发布