Polygons#
Download this notebook from GitHub (right-click to download).
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)
pop_est | continent | name | iso_a3 | gdp_md_est | geometry | |
---|---|---|---|---|---|---|
137 | 25364307.0 | Oceania | Australia | AUS | 1396567 | MULTIPOLYGON (((147.68926 -40.80826, 148.28907... |
55 | 23310715.0 | Africa | Niger | NER | 12911 | POLYGON ((14.85130 22.86295, 15.09689 21.30852... |
9 | 44938712.0 | South America | Argentina | ARG | 445445 | MULTIPOLYGON (((-68.63401 -52.63637, -68.25000... |
124 | 83429615.0 | Asia | Turkey | TUR | 761425 | MULTIPOLYGON (((44.77268 37.17044, 44.29345 37... |
75 | 11530580.0 | Africa | Burundi | BDI | 3012 | POLYGON ((30.46967 -2.41385, 30.52766 -2.80762... |
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')
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.
Download this notebook from GitHub (right-click to download).