ShapelyFeature.阅读器不在Cartopy工作

2024-03-29 14:01:51 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在运行以下简单代码:

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


Tags: fromimportmatplotlibaspltaxfnamefeature