import hvplot.pandas # noqa
Using hvplot with geopandas is as simple as loading a geopandas dataframe and calling hvplot
on it with geo=True
.
import geopandas as gpd
countries = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
countries.sample(5)
countries.hvplot(geo=True)
Control the color of the elements using the c
option.
countries.hvplot.polygons(geo=True, c='pop_est', hover_cols='all')
You can even color by another series, such as population density:
countries.hvplot.polygons(geo=True, c=countries.pop_est/countries.area, clabel='pop density')