网格搜索三维热图python代码
时间: 2023-03-12 20:12:00 浏览: 144
网格搜索算法(基于Python编程语言实现)
我推荐您参考下面的代码片段:import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D# Generate data
X = np.arange(-4, 4, 0.25)
Y = np.arange(-4, 4, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)# Plot the surface
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap='hot')plt.show()
阅读全文