Matplotlib绘制三维线形图

Matplotlib编程实现

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D

x = np.linspace(0, 40, 1000)
y = np.sin(x)
z = np.cos(x)

fig = plt.figure(figsize=(8, 6))
ax = Axes3D(fig)

ax.plot(x, y, z, color="deeppink")

ax.set(xlabel="X", ylabel="Y", zlabel="Z")

ax.set_yticks([-1, 0, 1])
ax.set_yticklabels(['min', 0, 'max'])

plt.show()

成品图

在这里插入图片描述

发布了505 篇原创文章 · 获赞 999 · 访问量 19万+

猜你喜欢

转载自blog.csdn.net/weixin_43896318/article/details/104296976