效果图:
代码:
1
from matplotlib import pyplot as plt
2import numpy as np
3from mpl_toolkits.mplot3d import Axes3D
4 fig = plt.figure()
5 ax = Axes3D(fig)
6 X = np.arange(-4, 4, 0.25)
7 Y = np.arange(-4, 4, 0.25)
8 X, Y = np.meshgrid(X, Y)
9 R = np.sqrt(X ** 2 + Y ** 2)
10 Z = np.sin(R)
11 ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=‘rainbow‘)
12 plt.show()
原文:https://www.cnblogs.com/smartisn/p/12914033.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!