Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Image hover #2625

Merged
merged 1 commit into from
Apr 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions holoviews/plotting/bokeh/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from bokeh.models import HoverTool
from ...core.util import cartesian_product, dimension_sanitizer
from ...element import Raster
from ...element import Raster, RGB, HSV
from .element import ElementPlot, ColorbarPlot, line_properties, fill_properties
from .util import mpl_to_bokeh, colormesh
from .util import mpl_to_bokeh, colormesh, bokeh_version


class RasterPlot(ColorbarPlot):
Expand All @@ -17,6 +17,14 @@ class RasterPlot(ColorbarPlot):

style_opts = ['cmap']
_plot_methods = dict(single='image')

def _hover_opts(self, element):
xdim, ydim = element.kdims
tooltips = [(xdim.pprint_label, '$x'), (ydim.pprint_label, '$y')]
if bokeh_version >= '0.12.16' and not isinstance(element, (RGB, HSV)):
vdim = element.vdims[0]
tooltips.append((vdim.pprint_label, '@image'))
return tooltips, {}

def __init__(self, *args, **kwargs):
super(RasterPlot, self).__init__(*args, **kwargs)
Expand Down