Matplotlib绘制七彩锥面

Matplotlib编程实现

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

fig = plt.figure()
axes3d = Axes3D(fig)

x = np.linspace(-15, 15, 100)
y = np.linspace(-15, 15, 100)
x, y = np.meshgrid(x, y)
z = np.sqrt(x ** 2 + y ** 2)

axes3d.plot_surface(x, y, z, rstride=1, cstride=1, cmap=plt.get_cmap('rainbow'))

plt.show()

成品图欣赏

在这里插入图片描述

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

猜你喜欢

转载自blog.csdn.net/weixin_43896318/article/details/104299396
今日推荐