我正在运行以下简单代码:
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import cartopy.crs as ccrs
from cartopy.io import shapereader as shpreader
from cartopy.feature import ShapelyFeature
fname = r'C:/cb_2018_us_cd116_500k.shp'
ax = plt.axes(projection=ccrs.Robinson())
shape_feature = ShapelyFeature(shpreader(fname).geometries(),
ccrs.PlateCarree(), facecolor='none')
ax.add_feature(shape_feature)
plt.show()
我得到以下错误:
shape_feature = ShapelyFeature(shpreader(fname).geometries(),
TypeError: 'module' object is not callable
有人能帮忙吗?你知道吗
我在windows10上运行python3.6
shapereader as shpreader
是模块,您需要的是该模块中存在的类,即cartopy.io.shapereader.Reader相关问题 更多 >
编程相关推荐