hvplot icon indicating copy to clipboard operation
hvplot copied to clipboard

Support datashade points hover

Open ahuang11 opened this issue 1 year ago • 9 comments

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

ahuang11 avatar Oct 02 '24 23:10 ahuang11

Tap instead of PointerXY for big datasets

https://github.com/user-attachments/assets/64ff6c5d-d390-4de9-8f30-ca54d650e892

ahuang11 avatar Oct 03 '24 00:10 ahuang11

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.

codecov[bot] avatar Oct 03 '24 00:10 codecov[bot]

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.

philippjfr avatar Oct 03 '24 15:10 philippjfr

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?

ahuang11 avatar Oct 08 '24 16:10 ahuang11

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 .

maximlt avatar Dec 12 '24 14:12 maximlt

bumping this, now that Datashader inspections for HoloViews is merged

droumis avatar Apr 03 '25 20:04 droumis

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).

maximlt avatar Apr 04 '25 07:04 maximlt

Whether via this PR or another, I strongly support surfacing the improved inspection support from HoloViews so that it is conveniently expose in hvPlot.

jbednar avatar Apr 16 '25 15:04 jbednar

Yes that's the plan, once it's documented and released in Holoviews, and then implemented and documented in hvPlot.

maximlt avatar Apr 16 '25 16:04 maximlt