Skip to main content
Ctrl+K
HoloViews v1.21.0a0 - Home HoloViews v1.21.0a0 - Home
  • Getting Started
  • User Guide
  • Gallery
  • Reference Gallery
  • Developer Guide
    • Releases
    • API
    • FAQ Roadmap
    • About
  • GitHub
  • Twitter
  • Discourse
  • Discord
  • Getting Started
  • User Guide
  • Gallery
  • Reference Gallery
  • Developer Guide
  • Releases
  • API
  • FAQ Roadmap
  • About
  • GitHub
  • Twitter
  • Discourse
  • Discord
  • Getting Started
    • Introduction
    • Customization
    • Tabular Datasets
    • Gridded Datasets
    • Live Data
  • User Guide
    • Annotating your Data
    • Composing Elements
    • Applying Customizations
    • Style Mapping
    • Dimensioned Containers
    • Building Composite Objects
    • Live Data
    • Tabular Datasets
    • Gridded Datasets
    • Geometry Data
    • Indexing and Selecting Data
    • Transforming Elements
    • Responding to Events
    • Custom Interactivity
    • Data Processing Pipelines
    • Creating interactive network graphs
    • Working with large data
    • Working with streaming data
    • Creating interactive dashboards
    • Customizing Plots
    • Colormaps
    • Plotting with Bokeh
    • Deploying Bokeh Apps
    • Linking Bokeh plots
    • Plotting with matplotlib
    • Working with Plot and Renderers
    • Linked Brushing
    • Annotators
    • Exporting and Archiving
    • Continuous Coordinates
    • Notebook Magics
  • Gallery
    • Applications
      • Bokeh
        • Crossfilter
        • Game Of Life
        • Gapminder
        • Mandelbrot
        • Nytaxi Hover
        • Streaming Psutil
    • Demos
      • Bokeh
        • Area Chart
        • Autompg Histogram
        • Autompg Violins
        • Bachelors Degrees By Gender
        • Bars Economic
        • Box Draw Roi Editor
        • Boxplot Chart
        • Choropleth Data Link
        • Directed Airline Routes
        • Dot Example
        • Dragon Curve
        • Dropdown Economic
        • Emoji Tsne
        • Energy Sankey
        • Hextile Movie Ratings
        • Histogram Example
        • Html Hover Tooltips
        • Image Range Tool
        • Iris Density Grid
        • Iris Example
        • Iris Grouped Grid
        • Iris Splom Example
        • Irregular Quadmesh
        • Legend Example
        • Lesmis Example
        • Life Expectancy Split Violin
        • Lorenz Attractor Example
        • Mandelbrot Section
        • Measles Example
        • Multichannel Timeseries Viewer
        • Network Graph
        • Nyc Airport Connections
        • Nyc Radial Heatmap
        • Point Draw Triangulate
        • Quiver Demo
        • Route Chord
        • Scatter Economic
        • Square Limit
        • Step Chart
        • Stocks Example
        • Texas Choropleth Example
        • Timeseries Range Tool
        • Topographic Hillshading
        • Us Unemployment
        • Verhulst Mandelbrot
  • Reference Gallery
    • Elements
      • Bokeh
        • Area
        • Arrow
        • Bars
        • Bivariate
        • Bounds
        • Box
        • BoxWhisker
        • Chord
        • Contours
        • Curve
        • Dendrogram
        • Distribution
        • Div
        • Ellipse
        • ErrorBars
        • Graph
        • HLine
        • HLines
        • HSV
        • HSpan
        • HSpans
        • HeatMap
        • HexTiles
        • Histogram
        • Image
        • ImageStack
        • ItemTable
        • Labels
        • Path
        • Points
        • Polygons
        • QuadMesh
        • RGB
        • RadialHeatMap
        • Raster
        • Rectangles
        • Sankey
        • Scatter
        • Segments
        • Slope
        • Spikes
        • Spline
        • Spread
        • Table
        • Text
        • Tiles
        • TriMesh
        • VLine
        • VLines
        • VSpan
        • VSpans
        • VectorField
        • Violin
    • Containers
      • Bokeh
        • DynamicMap
        • GridSpace
        • HoloMap
        • Layout
        • NdLayout
        • NdOverlay
        • Overlay
      • Matplotlib
        • DynamicMap
        • GridSpace
        • HoloMap
        • Layout
        • NdLayout
        • NdOverlay
        • Overlay
      • Plotly
        • DynamicMap
        • GridSpace
        • HoloMap
        • Layout
        • NdLayout
        • NdOverlay
        • Overlay
    • Streams
      • Bokeh
        • Bounds
        • BoundsX
        • BoundsY
        • BoxEdit
        • CurveEdit
        • FreehandDraw
        • PointDraw
        • PointerX
        • PointerXY
        • PolyDraw
        • PolyEdit
        • RangeXY
        • Selection1D
        • Selection1D Paired
        • Selection1D Points
        • Selection1D Tap
        • Tap
      • Plotly
        • Bounds
        • BoundsX
        • BoundsY
        • RangeXY
        • Selection1D Paired
        • Selection1D Points
    • Apps
      • Bokeh
        • Player
        • Selection Stream
        • Sine
    • Features
      • Bokeh
        • Scalebar
  • Developer Guide
  • Releases
  • API
    • annotators
    • core
      • holoviews.core.data package
        • holoviews.core.data.array module
        • holoviews.core.data.cudf module
        • holoviews.core.data.dask module
        • holoviews.core.data.dictionary module
        • holoviews.core.data.grid module
        • holoviews.core.data.ibis module
        • holoviews.core.data.image module
        • holoviews.core.data.interface module
        • holoviews.core.data.multipath module
        • holoviews.core.data.pandas module
        • holoviews.core.data.spatialpandas module
        • holoviews.core.data.spatialpandas_dask module
        • holoviews.core.data.util module
        • holoviews.core.data.xarray module
      • holoviews.core.accessors module
      • holoviews.core.boundingregion module
      • holoviews.core.decollate module
      • holoviews.core.dimension module
      • holoviews.core.element module
      • holoviews.core.io module
      • holoviews.core.layout module
      • holoviews.core.ndmapping module
      • holoviews.core.operation module
      • holoviews.core.options module
      • holoviews.core.overlay module
      • holoviews.core.pprint module
      • holoviews.core.sheetcoords module
      • holoviews.core.spaces module
      • holoviews.core.traversal module
      • holoviews.core.tree module
      • holoviews.core.util module
    • core.data
      • holoviews.core.data.array module
      • holoviews.core.data.cudf module
      • holoviews.core.data.dask module
      • holoviews.core.data.dictionary module
      • holoviews.core.data.grid module
      • holoviews.core.data.ibis module
      • holoviews.core.data.image module
      • holoviews.core.data.interface module
      • holoviews.core.data.multipath module
      • holoviews.core.data.pandas module
      • holoviews.core.data.spatialpandas module
      • holoviews.core.data.spatialpandas_dask module
      • holoviews.core.data.util module
      • holoviews.core.data.xarray module
    • element
      • holoviews.element.annotation module
      • holoviews.element.chart module
      • holoviews.element.chart3d module
      • holoviews.element.comparison module
      • holoviews.element.geom module
      • holoviews.element.graphs module
      • holoviews.element.path module
      • holoviews.element.raster module
      • holoviews.element.sankey module
      • holoviews.element.selection module
      • holoviews.element.stats module
      • holoviews.element.tabular module
      • holoviews.element.tiles module
      • holoviews.element.util module
    • ipython
      • holoviews.ipython.archive module
      • holoviews.ipython.display_hooks module
      • holoviews.ipython.magics module
      • holoviews.ipython.preprocessors module
      • holoviews.ipython.widgets module
    • operation
      • holoviews.operation.datashader module
      • holoviews.operation.downsample module
      • holoviews.operation.element module
      • holoviews.operation.normalization module
      • holoviews.operation.resample module
      • holoviews.operation.stats module
      • holoviews.operation.timeseries module
    • plotting
      • holoviews.plotting.bokeh package
        • holoviews.plotting.bokeh.annotation module
        • holoviews.plotting.bokeh.callbacks module
        • holoviews.plotting.bokeh.chart module
        • holoviews.plotting.bokeh.element module
        • holoviews.plotting.bokeh.geometry module
        • holoviews.plotting.bokeh.graphs module
        • holoviews.plotting.bokeh.heatmap module
        • holoviews.plotting.bokeh.hex_tiles module
        • holoviews.plotting.bokeh.links module
        • holoviews.plotting.bokeh.path module
        • holoviews.plotting.bokeh.plot module
        • holoviews.plotting.bokeh.raster module
        • holoviews.plotting.bokeh.renderer module
        • holoviews.plotting.bokeh.sankey module
        • holoviews.plotting.bokeh.selection module
        • holoviews.plotting.bokeh.stats module
        • holoviews.plotting.bokeh.styles module
        • holoviews.plotting.bokeh.tabular module
        • holoviews.plotting.bokeh.tiles module
        • holoviews.plotting.bokeh.util module
      • holoviews.plotting.mpl package
        • holoviews.plotting.mpl.annotation module
        • holoviews.plotting.mpl.chart module
        • holoviews.plotting.mpl.chart3d module
        • holoviews.plotting.mpl.element module
        • holoviews.plotting.mpl.geometry module
        • holoviews.plotting.mpl.graphs module
        • holoviews.plotting.mpl.heatmap module
        • holoviews.plotting.mpl.hex_tiles module
        • holoviews.plotting.mpl.path module
        • holoviews.plotting.mpl.plot module
        • holoviews.plotting.mpl.raster module
        • holoviews.plotting.mpl.renderer module
        • holoviews.plotting.mpl.sankey module
        • holoviews.plotting.mpl.stats module
        • holoviews.plotting.mpl.tabular module
        • holoviews.plotting.mpl.util module
      • holoviews.plotting.plotly package
        • holoviews.plotting.plotly.annotation module
        • holoviews.plotting.plotly.callbacks module
        • holoviews.plotting.plotly.chart module
        • holoviews.plotting.plotly.chart3d module
        • holoviews.plotting.plotly.dash module
        • holoviews.plotting.plotly.element module
        • holoviews.plotting.plotly.images module
        • holoviews.plotting.plotly.plot module
        • holoviews.plotting.plotly.raster module
        • holoviews.plotting.plotly.renderer module
        • holoviews.plotting.plotly.selection module
        • holoviews.plotting.plotly.shapes module
        • holoviews.plotting.plotly.stats module
        • holoviews.plotting.plotly.tabular module
        • holoviews.plotting.plotly.tiles module
        • holoviews.plotting.plotly.util module
      • holoviews.plotting.links module
      • holoviews.plotting.mixins module
      • holoviews.plotting.plot module
      • holoviews.plotting.renderer module
      • holoviews.plotting.util module
    • plotting.bokeh
      • holoviews.plotting.bokeh.annotation module
      • holoviews.plotting.bokeh.callbacks module
      • holoviews.plotting.bokeh.chart module
      • holoviews.plotting.bokeh.element module
      • holoviews.plotting.bokeh.geometry module
      • holoviews.plotting.bokeh.graphs module
      • holoviews.plotting.bokeh.heatmap module
      • holoviews.plotting.bokeh.hex_tiles module
      • holoviews.plotting.bokeh.links module
      • holoviews.plotting.bokeh.path module
      • holoviews.plotting.bokeh.plot module
      • holoviews.plotting.bokeh.raster module
      • holoviews.plotting.bokeh.renderer module
      • holoviews.plotting.bokeh.sankey module
      • holoviews.plotting.bokeh.selection module
      • holoviews.plotting.bokeh.stats module
      • holoviews.plotting.bokeh.styles module
      • holoviews.plotting.bokeh.tabular module
      • holoviews.plotting.bokeh.tiles module
      • holoviews.plotting.bokeh.util module
    • plotting.plotly
      • holoviews.plotting.plotly.annotation module
      • holoviews.plotting.plotly.callbacks module
      • holoviews.plotting.plotly.chart module
      • holoviews.plotting.plotly.chart3d module
      • holoviews.plotting.plotly.dash module
      • holoviews.plotting.plotly.element module
      • holoviews.plotting.plotly.images module
      • holoviews.plotting.plotly.plot module
      • holoviews.plotting.plotly.raster module
      • holoviews.plotting.plotly.renderer module
      • holoviews.plotting.plotly.selection module
      • holoviews.plotting.plotly.shapes module
      • holoviews.plotting.plotly.stats module
      • holoviews.plotting.plotly.tabular module
      • holoviews.plotting.plotly.tiles module
      • holoviews.plotting.plotly.util module
    • selection
    • streams
    • util
      • holoviews.util.command module
      • holoviews.util.locator module
      • holoviews.util.parser module
      • holoviews.util.settings module
      • holoviews.util.transform module
      • holoviews.util.warnings module
  • FAQ Roadmap
  • About
HoloViz.org
  • Panel
  • hvPlot
  • GeoViews
  • Datashader
  • Param
  • Lumen
  • Colorcet

  • Examples Gallery
  • Blog
  • Gallery
  • Demos
  • Bokeh
  • Choropleth Data Link

Choropleth Data Link#

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


import holoviews as hv
from holoviews import opts
from holoviews.plotting.links import DataLink

hv.extension('bokeh')

This example demonstrates how to use a DataLink to join two elements displaying the same data, a choropleth of the Texas unemployment rate alongside a Table of the same data. By linking the two selecting a polygon will highlight it in the table and vice versa.

Declare data#

from bokeh.sampledata.unemployment import data as unemployment
from bokeh.sampledata.us_counties import data as counties

counties = [dict(county, Unemployment=unemployment[cid])
            for cid, county in counties.items()
            if county["state"] == "tx"]


county_data = [(county['detailed_name'], county['Unemployment']) for county in counties]

choropleth = hv.Polygons(counties, ['lons', 'lats'], [('detailed_name', 'County'), 'Unemployment'], label='Texas Unemployment')
table = hv.Table(county_data, [('detailed_name', 'County'), 'Unemployment'])

print(len(choropleth.data), len(table))
254 254

Declare Plot#

As shown above the two elements have the same length meaning that they can be linked. Linking the data in this way allows cross-selecting, e.g. by selecting one or more rows in the Table we can see the polygon for the county highlight in the choropleth:

# Link the choropleth and the table
DataLink(choropleth, table)

(choropleth + table).opts(
    opts.Table(height=428),
    opts.Polygons(width=500, height=500,  tools=['hover', 'tap'], xaxis=None,
                  yaxis=None, color_index='Unemployment'))
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).

previous

Boxplot Chart

next

Directed Airline Routes

On this page
  • Declare data
  • Declare Plot

This Page

  • Show Source

© Copyright 2005 HoloViz developers.

Created using Sphinx 8.2.3.

Built with the PyData Sphinx Theme 0.16.1.