How to create a Choropleth Map on Python in 3 screenshots
Jul 11, 2021
- provides a way to visualize values over a geographical area, which can show variation or patterns across the displayed location.
- The data variable uses color progression to represent itself in each region of the map.
Screenshot 1 — That your data:
!pip install geopandas
!pip install geoplot
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import geopandas
import geoplot
Screenshot 2 — That your actions:
# world data from geopandas
# https://geopandas.org/index.html
world_data = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
world_data.head()
Screenshot 3— Make it look better:
import mapclassify
gpd_per_person = world_data['gdp_md_est'] / world_data['pop_est']
scheme = mapclassify.Quantiles(gpd_per_person, k=5)
geoplot.choropleth(world_data, hue=gpd_per_person, scheme=scheme, figsize=(14, 8))
For more visualization and analytics
https://drivenn.io/