diff --git a/hvplot/converter.py b/hvplot/converter.py index 3bb31c175..fde980854 100644 --- a/hvplot/converter.py +++ b/hvplot/converter.py @@ -1830,6 +1830,11 @@ def method_wrapper(ds, x, y): # a workaround to show hover info for datashaded points if self.hover and self.datashade and self.kind == 'points': + if self.hover_mode != 'mouse': + param.main.param.warning( + f'Got unsupported hover_mode={self.hover_mode!r} for ' + f"datashaded points; reverting to 'mouse'." + ) inspector = inspect_points.instance( streams=[PointerXY], transform=self._datashade_hover_transform ) diff --git a/hvplot/tests/testoperations.py b/hvplot/tests/testoperations.py index 3462d4a5c..ddcf87943 100644 --- a/hvplot/tests/testoperations.py +++ b/hvplot/tests/testoperations.py @@ -8,7 +8,7 @@ import pandas as pd import pytest -from holoviews import Store, render +from holoviews import Store, render, renderer from holoviews.element import Image, QuadMesh, Points from holoviews.core.spaces import DynamicMap from holoviews.core.overlay import Overlay @@ -324,6 +324,23 @@ def test_downsample_resample_when(self, kind, eltype): assert isinstance(element, eltype) assert len(element) == 0 + @parameterized.expand([(None,), (True,), ('vline',), ('hline',)]) + def test_include_inspect_point_hover(self, hover): + df = pd.DataFrame( + np.random.multivariate_normal((0, 0), [[0.1, 0.1], [0.1, 1.0]], (5000,)) + ).rename({0: 'x', 1: 'y'}, axis=1) + + p = df.hvplot.points(datashade=True, hover=hover) + assert renderer('bokeh').get_plot(p).name.startswith('Overlay') + + def test_include_inspect_point_no_hover(self): + df = pd.DataFrame( + np.random.multivariate_normal((0, 0), [[0.1, 0.1], [0.1, 1.0]], (5000,)) + ).rename({0: 'x', 1: 'y'}, axis=1) + + p = df.hvplot.points(datashade=True, hover=False) + assert renderer('bokeh').get_plot(p).name.startswith('RGB') + class TestChart2D(ComparisonTestCase): def setUp(self):