函数图形绘制

import matplotlib.pyplot as plt

import numpy as np

x = np.arange(0, 10, 0.0001)

y1 = x ** 2

y2 = np.cos(x * 2)

y3 = y1 * y2

plt.plot(x, y1,linestyle='-.')

plt.plot(x, y2,linestyle=':')

plt.plot(x, y3,linestyle='--')

plt.savefig("3-1.png")

plt.show()

fig, subs = plt.subplots(2, 2)

subs[0][0].plot(x, y1)

subs[0][1].plot(x, y2)

subs[1][0].plot(x, y3)

plt.savefig("3-2.png")

plt.show()

![image.png]({PTA_URL}/api/private-image?p=user-uploads/1566653959899246592/2024-6-5/1717546193-9a2df60e-378a-4cce-b202-8c9f97e6b1a7.png)

![image.png]({PTA_URL}/api/private-image?p=user-uploads/1566653959899246592/2024-6-5/1717546203-96d500fa-f432-42e9-ad94-980bbd2524bf.png)

posted @   混沌武士丞  阅读(11)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示