In [12]:
import pysal as ps
import geopandas as gpd
import folium_mapping as fm
%matplotlib inline
Let's look at the columns that we're going to map.
In [9]:
df = gpd.read_file('./example.json')
In [13]:
df.HR90.hist()
Out[13]:
To use the folium mapper, you pass the the geodataframe, a unique key for the geometries, & the attribute to be mapped:
In [15]:
fm.choropleth_map(df, key='FIPS', attribute='HR90')
Out[15]:
In [18]:
fm.choropleth_map(ex, 'FIPS', 'HR90', classification = 'Equal Interval')
Out[18]:
Most PySAL
classifiers are supprorted.
In [19]:
fm.choropleth_map(ex, 'FIPS', 'HR90',
classification = 'Jenks Caspall',
tiles='Stamen Toner', save=True)
Out[19]:
We support the entire range of builtin basemap types in Folium, but custom tilesets from MapBox are not supported yet.
In [20]:
fm.choropleth_map(ex, 'FIPS', 'HR80',
classification = 'Jenks Caspall',
tiles='Stamen Toner', fill_color = 'PuBuGn', save=True)
Out[20]:
All color schemes are Color Brewer and simply pass through to Folium
on execution.
In [25]:
fm.choropleth_map('./example.json', 'FIPS', 'HR80',
classification = 'Jenks Caspall',
classes=3, tiles='Stamen Toner',
fill_color='PuBuGn',save=True)
Out[25]:
In [27]:
fm.choropleth_map(ex, 'FIPS', 'HR90',
classification = 'Quantiles',
std='HR80' , tiles='Stamen Toner',
fill_color='PuBuGn',save=True)
Out[27]: