Skip to content

Instantly share code, notes, and snippets.

@jamesdamillington
Last active September 21, 2023 16:47
Show Gist options
  • Save jamesdamillington/4d4f53a61f0b9f96a05d547bd9246043 to your computer and use it in GitHub Desktop.
Save jamesdamillington/4d4f53a61f0b9f96a05d547bd9246043 to your computer and use it in GitHub Desktop.
Testing mapclassify with geopandas
import geopandas as gpd
import pandas as pd
england = pd.read_csv("https://raw.githubusercontent.com/jamesdamillington/spar/main/data/brexit/brexit_vote.csv",
index_col='Area_Code')
lads = gpd.read_file("https://raw.githubusercontent.com/jamesdamillington/spar/main/data/brexit/local_authority_districts.geojson").set_index('lad16cd')
Egdf = lads.merge(england, how='inner',
left_index=True, right_index=True)
col='Pct_Leave'
Egdf.plot(column=col, cmap='viridis',
scheme='quantiles', k=5,
linewidth=0.,
legend=True, legend_kwds={"title":col,"loc": 2})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment