Here is the explanation for the preceding code:
- shpfilename = shapereader.natural_earth(resolution='10m', category='cultural', name='admin_0_countries') downloads the required shapefile from the Natural Earth data website.
- df0 = geopandas.read_file(shpfilename) reads the contents of the shapefile into the df0 pandas DataFrame object.
- ax1.set_extent([-130, -66.5, 25, 50], crs=ccrs.PlateCarree()) sets the extent for the USA.
- poly = df0.loc[df0['ADMIN'] == 'United States of America']['geometry'] reads specific blocks to be plotted as polygons from the pandas DataFrame:
- The df0 DataFrame has an 'ADMIN' column that stores the name of the country, which is used to extract specific contents related to the USA.
- geometry is another ...