哪位帮我看看,我刚学matplotlib
import matplotlib.pyplot as plt
import numpy as np
X = np.linspace(0,4,100)
Y = np.linspace(0,4,100)
X,Y = np.meshgrid(X,Y) #没加这个就报错,不是二维数组
# Z = 5.99 + 17.438*X + 29.787*Y - 3.558*X*X + 0.357*X*Y -8.070*Y*Y
Z = -48.810+37.557*X + 130.130*Y +8.389*X*X - 33.166*X*Y - 62.740*Y*Y - 4.133*X*X*X +6.138*X*X*Y + 2.566*X*Y*Y+9.785*Y*Y*Y
ax = plt.figure().add_subplot(projection='3d')
tick = np.linspace(0,4,8)
# Plot the 3D surface
ax.plot_surface(X, Y,Z,cmap = 'rainbow')
plt.xticks(tick)
plt.yticks(tick)
plt.scatter(1,1,45.715999999999994)#图上某个点的坐标
plt.show()
一开始没加x,y = np.meshgrid(x,y)报错
加上之后就出了图
然后我就想看看这图对不对,
就在图上做了一个点的位置,
然后我看图那个点并不在曲面上,