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
from holoviews import opts
hv.extension('bokeh')
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"]
choropleth = hv.Polygons(counties, ['lons', 'lats'], [('detailed_name', 'County'), 'Unemployment'])
Plot#
choropleth.opts(
opts.Polygons(logz=True, tools=['hover'], xaxis=None, yaxis=None,
show_grid=False, show_frame=False, width=500, height=500,
color_index='Unemployment', colorbar=True, toolbar='above', line_color='white'))
WARNING:param.PolygonPlot: The `color_index` parameter is deprecated in favor of color style mapping, e.g. `color=dim('color')` or `line_color=dim('color')`
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).