错误是
file "contour.py",line 19,in <module>c = plt.contour(EF,EB,a) file "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py",line 2016,in contour ret = ax.contour(*args,**kwargs) file "/usr/lib/pymodules/python2.7/matplotlib/axes.py",line 7326,in contour return mcontour.QuadContourSet(self,*args,**kwargs) file "/usr/lib/pymodules/python2.7/matplotlib/contour.py",line 1088,in __init__ ContourSet.__init__(self,ax,line 686,in __init__ self._process_args(*args,line 1101,in _process_args x,y,z = self._contour_args(args,kwargs) file "/usr/lib/pymodules/python2.7/matplotlib/contour.py",line 1148,in _contour_args x,z = self._check_xyz(args[:3],line 1180,in _check_xyz raise TypeError("input z must be a 2D array.")TypeError: input z must be a 2D array.解决方法 错误说明了这一点
TypeError: input z must be a 2D array.
如果你看一下输入对象的大小:
print EF.shape,EB.shape,a.shape(51,) (51,)
你会发现这些不是2D数组.你打算用X和Y代替吗?
当我做出改变时
a = ((1+.5*(np.exp(1.7*X)+np.exp(1.7*Y)+np.exp(1.7*(X+Y))))/(1+np.exp(1.7*X)+np.exp(1.7*Y)+np.exp(1.7*(X+Y))))c = plt.contour(EF,a,30)
输出是
看起来您可能需要调整参数空间,因为所有有趣的东西都在(0,0)左右.
总结以上是内存溢出为你收集整理的等高线图python中的长错误全部内容,希望文章能够帮你解决等高线图python中的长错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)