Last active
October 23, 2024 09:30
-
-
Save MarcSkovMadsen/c31afa6db9e55e3f50f582b24ad60a34 to your computer and use it in GitHub Desktop.
Linked brushing with HoloViz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install panel==0.12.4 bokeh==2.4.0 holoviews==1.14.6 hvplot==0.7.3 shapely==1.7.1 | |
# panel serve holoviz_linked_brushing.py --autoreload --show | |
import hvplot.pandas | |
import holoviews as hv | |
import panel as pn | |
from bokeh.sampledata.iris import flowers | |
pn.extension(sizing_mode="stretch_width") | |
hv.extension("bokeh") | |
accent_color = "#ff286e" | |
scatter = flowers.hvplot.scatter( | |
x="sepal_length", y="sepal_width", c=accent_color, responsive=True, height=350 | |
) | |
hist = flowers.hvplot.hist("petal_width", c=accent_color, responsive=True, height=350) | |
scatter.opts(size=10) | |
selection_linker = hv.selection.link_selections.instance() | |
scatter = selection_linker(scatter) | |
hist = selection_linker(hist) | |
scatter.opts(tools=["hover"], active_tools=["box_select"]) | |
hist.opts(tools=["hover"], active_tools=["box_select"]) | |
pn.template.FastListTemplate( | |
site="Awesome Panel and HoloViews", | |
title="Cross Filtering/ Linked Brushing", | |
header_background=accent_color, | |
main=[scatter, hist], | |
).servable() |
For more inspiration see
- hvplot https://hvplot.holoviz.org/
- Holoviews: https://holoviews.org/
- Datashader: https://datashader.org/
- Panel: https://panel.holoviz.org/
- HoloViz Cross filtering video: https://www.youtube.com/watch?v=AmHz31GrvkA
- awesome-panel.org: https://awesome-panel.org/
cross-filter-panel.mp4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Join the community discussion of this showcase here https://discourse.holoviz.org/t/easy-cross-filtering-with-holoviz-video/2297