我正在 Cartopy 中绘制世界地图,作为该过程的一部分,我想将所有线条都涂成白色。除了地图的边界之外,我已经能够对每个元素都这样做。这是我正在使用的代码:
import matplotlib.pyplot as plt
import cartopy
import cartopy.io.shapereader as shpreader
import cartopy.crs as ccrs
fig = plt.Figure()
fig.set_canvas(plt.gcf().canvas)
ax = plt.axes(projection=ccrs.PlateCarree())
ax.add_feature(cartopy.feature.LAND, linewidth=0.5, edgecolor='white')
ax.set_extent([-150,60,-25,60])
shpf = shpreader.natural_earth(resolution='110m', category='cultural', name='admin_0_countries')
reader = shpreader.Reader(shpf)
countries = reader.records()
for country in countries:
ax.add_geometries(country.geometry, ccrs.PlateCarree(), facecolor=(0,1,0), linewidth=0.5, edgecolor='white', label=country.attributes['adm0_a3'])
fig.savefig("final_image.png", format='png', dpi=200)
这是最终的结果:
关于如何以尽可能少的步骤将边界线更改为白色或完全关闭它的任何想法?
谢谢!