美文网首页
Python mtplotlib 绘制简单图像

Python mtplotlib 绘制简单图像

作者: Rinaloving | 来源:发表于2024-09-27 22:39 被阅读0次

安装 matplotlib

pip3 install matplotlib

sin 函数的图形

import numpy as np
import matplotlib.pyplot as plt

# 生成数据
x = np.arange(0, 6, 0.1) # 0 到 6,步长为0.1
y = np.sin(x)

# 绘制图形
plt.plot(x, y)
plt.show()
image.png

相关文章

网友评论

      本文标题:Python mtplotlib 绘制简单图像

      本文链接:https://www.haomeiwen.com/subject/igrlrjtx.html