Created
September 14, 2018 22:33
-
-
Save devdave/2e38e74d98f37715015a5acab45bed9b to your computer and use it in GitHub Desktop.
N America cartopy blank using Natural earth for fill in
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Features | |
-------- | |
A demonstration of some of the built-in Natural Earth features found | |
in cartopy. | |
modified from caropy examples/features.py | |
""" | |
__tags__ = ['Lines and polygons'] | |
import cartopy.crs as ccrs | |
import cartopy.feature as cfeature | |
import matplotlib.pyplot as plt | |
def main(): | |
fig = plt.figure() | |
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree()) | |
ax.set_extent([-166, -105, 71, 35], crs=ccrs.PlateCarree()) | |
states_provinces = cfeature.NaturalEarthFeature( | |
category='cultural', | |
name='admin_1_states_provinces_lines', | |
scale='50m', | |
facecolor='none') | |
roads = cfeature.NaturalEarthFeature( | |
category='cultural', | |
name='roads', | |
scale='10m', | |
facecolor='none') | |
cstline = cfeature.NaturalEarthFeature( | |
category="physical", | |
name="land", | |
scale="10m" | |
) | |
# ax.add_feature(cfeature.LAND) | |
ax.add_feature(cfeature.OCEAN) | |
# ax.add_feature(cfeature.COASTLINE) | |
ax.add_feature(cstline, edgecolor="black", facecolor="tan") | |
ax.add_feature(cfeature.BORDERS, linestyle=':') | |
ax.add_feature(states_provinces, edgecolor="black") | |
ax.add_feature(roads, edgecolor="gray") | |
# ax.add_feature(cfeature.LAKES, alpha=0.5) | |
# ax.add_feature(cfeature.RIVERS) | |
plt.show() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment