Add or remove NaturalEarth featuresΒΆ
cf. https://www.naturalearthdata.com/downloads
[1]:
%matplotlib inline
# for figures in notebook
# import & initialize epygram
import epygram
epygram.init_env()
import os
INPUTS_DIR = os.path.join('..', 'inputs')
[2]:
r = epygram.formats.resource(os.path.join(INPUTS_DIR, 'pgd.albachir-07km50.SAND.fa'), 'r')
[3]:
f = r.readfield('SFX.SAND')
[4]:
# no coastlines, no borders
fig, ax = f.cartoplot(natural_earth_features=[])
[5]:
import cartopy.feature as cfeature
# no coastlines, no borders
fig, ax = f.cartoplot(natural_earth_features=[])
# coastlines
ax.add_feature(cfeature.NaturalEarthFeature(category='physical',
name='coastline',
scale='10m',
facecolor='none',
edgecolor='k'))
# roads
ax.add_feature(cfeature.NaturalEarthFeature(category='cultural',
name='roads',
scale='10m',
facecolor='none',
edgecolor='r'))
[5]:
<cartopy.mpl.feature_artist.FeatureArtist at 0x74c6bd76ec50>
[ ]: