Reputation: 5878
I'm using matplotlib basemap to draw a map of the continental US. Is there some way to filter the coastline/country boundaries to just the US? Being Canadian I don't normally like to exclude Canada but would like to in this instance :-)
from mpl_toolkits.basemap import Basemap
plt.figure(figsize=(10,6))
m = Basemap(width=5e6,height=3e6,projection='laea',
resolution='c',lat_0=39, lon_0=-96)
m.drawcoastlines(color="grey")
m.drawcountries(color="grey")
m.drawstates(color="grey")
plt.show()
Upvotes: 4
Views: 2112
Reputation: 102862
You might want to check out Cartopy
instead. Basemap is mainly concerned with different map projections of the Earth, while Cartopy has the ability to use arbitrary maps from the NaturalEarthData datasets using the shapereader. Check out this example showing Hurricane Katrina's path over the continental US:
Upvotes: 6