Texas choropleth example

Download this notebook from GitHub (right-click to download).


URL: http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

Most examples work across multiple plotting backends, this example is also available for:

In [1]:
import holoviews as hv
hv.extension('matplotlib')
hv.output(fig='svg')

Declaring data

In [2]:
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

In [3]:
choropleth.opts(
    color='Unemployment', edgecolor='white',
    xaxis=None, yaxis=None, show_grid=False,
    show_frame=False, colorbar=True, fig_size=200)
Out[3]:

Download this notebook from GitHub (right-click to download).