0
Python3
与cartopy
工作时,我正在尝试从Natureal Earth数据库中绘制一个特定的河流。Cartopy:绘制特定河流的子集特征
这是很简单的绘制所有河流和然后设置的程度在特定区域:
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature
rivers = cartopy.feature.NaturalEarthFeature(
category='physical', name='rivers_lake_centerlines',
scale='10m', facecolor='none', edgecolor='blue')
fig, ax = plt.subplots(
nrows=1, ncols=1, subplot_kw={'projection': ccrs.PlateCarree()},
figsize=(10,6))
ax.add_feature(rivers, linewidth=1)
ax.set_extent([-65, -45, -40, -17.5])
plt.show()
(如下所示结果)
但是,如果我希望仅绘制特定的河流(为了说明Paraná,由于编码问题在数据中被命名为Paran?
,似乎没有明确的方式来做到这一点)The cartopy Feature interface documentation
任何想法如何使河流绘制线条,而不是多边形? – mbarete
愚蠢的问题 - 用'ax.add_geometries([rec.geometry],ccrs.PlateCarree(),edgecolor ='blue',facecolor ='none' – mbarete