Support datashade points hover
Adds support for hovering over datashaded points
Closes https://github.com/holoviz/hvplot/issues/1428
import pandas as pd
import hvplot.pandas
import datashader as ds
df = pd.DataFrame(
{
"lon": [-86.75, -86.75, -86.25, -86.25],
"lat": [33.75, 34.0, 34.49, 34.5],
"population": [100, 200, 300, 400],
"c": ["A", "B", "A", "B"],
}
)
p = df.hvplot.points(
"lon",
"lat",
hover_cols="all",
datashade=True,
dynspread=True,
aggregator=ds.count_cat("c"),
hover_tooltips=["lat", "lon", ("Population", "@population"), ("Alpha", "@A"), ("Beta", "@B")], # not necessary
padding=0.2
)
p
https://github.com/user-attachments/assets/a8a71946-5745-42c6-ba14-e40ca51b2865
Tap instead of PointerXY for big datasets
https://github.com/user-attachments/assets/64ff6c5d-d390-4de9-8f30-ca54d650e892
Codecov Report
Attention: Patch coverage is 46.15385% with 35 lines in your changes missing coverage. Please review.
Project coverage is 88.57%. Comparing base (
b36e3a1) to head (c792ae2). Report is 1 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| hvplot/converter.py | 36.36% | 35 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #1430 +/- ##
==========================================
- Coverage 88.94% 88.57% -0.37%
==========================================
Files 52 52
Lines 7751 7808 +57
==========================================
+ Hits 6894 6916 +22
- Misses 857 892 +35
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This is a (small) breaking change as the output of the DynamicMap generated by hvplot (with datashade=True, hover=True) is no longer an RGB but an Overlay. This could lead to problems in the future.
Yes, I haven't reviewed in detail but if this is the approach taken we should wait for https://github.com/orgs/holoviz/projects/9 to be addressed properly rather than "hacking" it with a fake layer at the hvplot layer.
this is the approach taken we should wait for https://github.com/orgs/holoviz/projects/9 to be addressed properly rather than "hacking" it with a fake layer at the hvplot layer.
To clarify, which tasks in https://github.com/orgs/holoviz/projects/9 should be completed first? Should we ditch this PR?
Marked this PR as Draft per the comments before. @hoxbro let us know if you can share the progress of https://github.com/orgs/holoviz/projects/9 .
bumping this, now that Datashader inspections for HoloViews is merged
bumping this, now that Datashader inspections for HoloViews is merged
It has been merged in HoloViews but has not yet made it into a final release. As far as I can see it hasn't been documented in HoloViews yet (I wouldn't release hvPlot with an undocumented HoloViews feature).
I am unsure if we should pursue this PR as the implementation seems to differ from how datashader inspections ended up being implemented in HoloViews (see https://github.com/holoviz/holoviews/pull/6422).
Whether via this PR or another, I strongly support surfacing the improved inspection support from HoloViews so that it is conveniently expose in hvPlot.
Yes that's the plan, once it's documented and released in Holoviews, and then implemented and documented in hvPlot.