Skip to content

Commit

Permalink
Updates to pass raster tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Oct 25, 2024
1 parent 3914656 commit 15846c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion holoviews/operation/datashader.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def _process(self, element, key=None):
agg[y.name] = agg[y.name].astype('datetime64[ns]')

if isinstance(agg, xr.Dataset) or agg.ndim == 2:
# Replacing x and y coordinates to avoid numerical precision issues
agg.attrs["rasterized"] = True # Setting this so we know data has been rasterized
return self.p.element_type(agg, **params)
else:
params['vdims'] = list(map(str, agg.coords[agg_fn.column].data))
Expand Down
7 changes: 5 additions & 2 deletions holoviews/plotting/bokeh/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from bokeh.models import CustomJS, CustomJSHover, DatetimeAxis, HoverTool
from bokeh.models.dom import Div, Span, Styles, ValueOf

from ...core.data import XArrayInterface
from ...core.util import cartesian_product, dimension_sanitizer, isfinite
from ...element import Raster
from ..util import categorical_legend
Expand Down Expand Up @@ -65,10 +66,12 @@ def _init_tools(self, element, callbacks=None):
if isinstance(tool, HoverTool):
hover = tool
break
if hover is None:
return tools

data = element.data

if hover is None or not (XArrayInterface.applies(data) and "rasterized" in data.attrs):
return tools

coords, vars = tuple(data.coords), tuple(data.data_vars)
dims = (*coords, *vars)

Expand Down

0 comments on commit 15846c1

Please sign in to comment.