我正在使用m.contourf()形式底图(http://matplotlib.org/basemap/api/basemap_api.html#mpl_toolkits.basemap.Basemap.contourf)创建填充等高线图。出于某种原因,自从我升级到Python 3.6并升级我的软件包numpy,scipy pandas等以来,我一直收到这个错误。但它在Python2.7中运行良好。
错误,
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/karthik/Documents/code/test_countourf.py", line 99, in <module>
map.contourf(x, y, _arr, zorder = 0, cmap = _cmap, norm = cNorm, levels=levels)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py", line 521, in with_transform
return plotfunc(self,x,y,data,*args,**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py", line 3644, in contourf
xx = x[x.shape[0]/2,:]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
我怀疑x.shape [0] / 2给出了一个浮点数(因为Python 3我认为)而不是一个可能是错误的整数,因为我没有在Python 2.7中看到错误。
有关如何在Python 3.6中修复它的任何想法?
谢谢!