Natural Earth and GeoPandas#

Demonstrate use of GeoPandas to highlight particular Natural Earth features.

Natural Earth with Geopandas

import matplotlib.pyplot as plt
import hyoga

# initialize figure
ax = plt.subplot()

# plot demo bedrock altitude
with'') as ds:
    ds.hyoga.plot.bedrock_altitude(ax=ax, vmin=0)

    # plot canonical Natural Earth background

    # get dataset crs, we need this
    crs = ds.proj4

# lock axes extent

# plot the Po river and Lago di Garda in blue
rivers ='rivers_lake_centerlines')
rivers[ == 'Po'].to_crs(crs).plot(ax=ax, edgecolor='tab:blue')
lakes ='lakes')
lakes[ == 'Lago di Garda'].to_crs(crs).plot(ax=ax)

# plot the outline of Switzerland in red
countries ='admin_0_countries', category='cultural')
countries[countries.NAME == 'Switzerland'].to_crs(crs).plot(
    ax=ax, edgecolor='tab:red', facecolor='none', linewidth=2)

# plot Austria's Salzburg state in green
states =
    'admin_1_states_provinces', category='cultural')
states[ == 'Salzburg'].to_crs(crs).plot(
    ax=ax, alpha=0.75, facecolor='tab:green')

# set title
ax.set_title('Natural Earth with Geopandas')

# show

Total running time of the script: ( 0 minutes 9.235 seconds)

Gallery generated by Sphinx-Gallery