为什么在第 10 行创建 3d 绘图时出现语法错误

时间:2021-03-26 05:48:36

标签: python numpy

第 10 行 X,Y =meshgrid 出现错误,我不知道为什么

from numpy import exp,arange
from pylab import meshgrid,cm,imshow,contour,clabel,colorbar,axis,title,show
import matplotlib.pyplot as plt
import numpy as np
import math

x = np.linspace(-(2 * np.pi), 2 * np.pi, 200)
y = np.linspace (-2,2,200)
def z_function(x,y): return (1+(2*(np.cos(x)**2 +4 * (y)*(np.sqrt(1-y**2))*(np.cos(x))*(np.sin(x)))) 
X, Y=meshgrid(x,y)
Z=z_function(X,Y)
ax = plt.axes(projection='3d')
ax.plot_surface(x,y,z)
plt.show()

0 个答案:

没有答案
相关问题