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

def gauss(x, y, c1, c2):
    return np.exp(-1 * ((x - c1) ** 2 + (y - c2) ** 2) / 2)

fig = plt.figure()
ax = Axes3D(fig)
X = np.arange(-4, 4, 0.15)
Y = np.arange(-4, 4, 0.15)
X, Y = np.meshgrid(X, Y)
#R = np.sqrt(X**2 + Y**2)
Z = gauss(X, Y, 1, 1)


ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap='rainbow')

plt.savefig('test.jpg')

Python用matplotlib绘制3D图片

相关文章:

  • 2022-12-23
  • 2021-05-31
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
猜你喜欢
  • 2021-12-28
  • 2021-12-18
  • 2021-04-11
  • 2021-11-28
  • 2021-05-04
  • 2021-10-31
相关资源
相似解决方案