holoviz / holoviz/datashader

Datashader with HoverLayer

Open
#430 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.6k
Forks
376
Avg merge
4h 32m
Merged PRs (30d)
1

Description

I tried to add HoverLayer to a datashader image and the hover data initially appears, but when I zoom in, the hover functionality doesn't seem to work.

I was using the nyc_taxi demo notebook as the basis, but with some modifications to plot my own data. It successfully plots the data and interactive zooming works, but it seems something is not quite right with the hover layer after zooming.

##Example:
import numpy as np
from functools import partial
from datashader.bokeh_ext import HoverLayer

x_range, y_range = ((-10975134.269,-10512411.001), (4414961.940,4896987.468))

def create_image90(x_range, y_range, w=plot_width, h=plot_height):
cvs = ds.Canvas(plot_width=w, plot_height=h, x_range=x_range, y_range=y_range)
agg = cvs.points(df, 'X_CORD', 'Y_CORD', ds.count())
img = tf.shade(agg.where(agg>np.percentile(agg,90)), cmap=inferno, how='eq_hist')
return tf.dynspread(img, threshold=0.3, max_px=4)

p = base_plot()
p.add_tile(STAMEN_TERRAIN)
export(create_image(*NYC),"NYCT_90th")

hover_layer = HoverLayer(agg=cvs.points(df, 'X_CORD', 'Y_CORD', ds.count()),
extent=(-10975134.269,4414961.940,-10512411.001,4896987.468),
field_name='Average Call Count',how='sum')
p.renderers.append(hover_layer.renderer)
p.add_tools(hover_layer.tool)
InteractiveImage(p, create_image90)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.