Texas Choropleth Example#
Download this notebook from GitHub (right-click to download).
URL: https://docs.bokeh.org/en/latest/docs/examples/topics/geo/texas_hover_map.html
Most examples work across multiple plotting backends, this example is also available for:
import holoviews as hv
hv.extension('matplotlib')
hv.output(fig='svg')
Declaring data#
from bokeh.sampledata.us_counties import data as counties
from bokeh.sampledata.unemployment import data as unemployment
counties = [dict(county, Unemployment=unemployment[cid])
for cid, county in counties.items()
if county["state"] == "tx"]
detailed_name = 'detailed_name' if counties[0].get('detailed_name') else 'detailed name' # detailed name was changed in Bokeh 3.0
choropleth = hv.Polygons(counties, ['lons', 'lats'], [(detailed_name, 'County'), 'Unemployment'])
Plot#
choropleth.opts(
color='Unemployment', edgecolor='white',
xaxis=None, yaxis=None, show_grid=False,
show_frame=False, colorbar=True, fig_size=200)
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).