本文共 308 字,大约阅读时间需要 1 分钟。
通过 matplotlib 模块, 绘制数据的曲线图
import numpy as npimport matplotlib.pyplot as pltx = np.linspace(0, 10, 1000)y = np.sin(x)plt.figure(figsize=(8, 4))plt.plot(x, y, label="$sin(x)$", color="red", linewidth=2)plt.xlabel("Time(s)")plt.ylabel("Volt")plt.title("PyPlot First Example")plt.ylim(-1.2, 1.2)plt.show()
输入结果:
转载地址:http://amfli.baihongyu.com/