question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HoloViews scatter plot hover is slow when color is set

See original GitHub issue

Please see recording below, you can see that both plots have same amount of data (30000 points) and settings, but one that uses regular bokeh works fast, whereas the one that is produced via holoviews is quite slow. The other thing I noticed is that if you remove color from the holoviews plot, it works as fast as pure bokeh.

ALL software version info

bokeh: 2.4.2
holoviews: 1.14.17
python: 3.9.7
ipython: 8.0.1
ipykernel: 6.7.0
ipywidgets: 7.6.5
jupyter_client: 6.1.12
jupyter_core: 4.9.1
jupyter_server: 1.4.1
jupyterlab: 3.2.1
notebook: 6.4.6
os x: 10.15.7
chrome: 97.0.4692.99

Complete, minimal, self-contained example code that reproduces the issue

import bokeh
import numpy as np
import pandas as pd
import holoviews as hv

from bokeh.plotting import figure, show
from bokeh.io import output_notebook
from bokeh.models import LinearColorMapper
from bokeh.layouts import row

hv.extension('bokeh')
output_notebook()

n = 30000
ds = pd.DataFrame({'x': np.random.rand(n), 'y': np.random.rand(n), 'z': np.random.rand(n)})

p_bk = figure(frame_height=300, frame_width=300, title='bokeh (fast)',
           tooltips=[
               ('x', '@x'), 
               ('y', '@y'), 
               ('z', '@z')])
transform = LinearColorMapper(palette='Viridis256', low=0, high=1)
p_bk.scatter('x', 'y', source=ds, color={'field': 'z', 'transform': transform})

p_hv = hv.Points(ds, ['x', 'y'], 'z') \
    .opts(tools=['hover'], color='z', cmap='Viridis', frame_width=300, frame_height=300, title='holoviews (slow)')
p_hv = hv.render(p_hv)

show(row(p_bk, p_hv))

Screenshots or screencasts of the bug in action

https://user-images.githubusercontent.com/4602302/151662499-cf21ede4-67a2-4ecc-948c-c78f1bc6cf3c.mp4

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
philippjfrcommented, Feb 14, 2022

Will reopen as bokeh performs additional rendering when setting hover properties. Therefore we should just avoid setting hover properties if they are equal to the non-hover value.

1reaction
stas-slcommented, Jan 29, 2022

Ahh, I see… Thanks for fast reply!

Actually it is slow even if you are not setting color, and set hover_color to constant:

p_bk.scatter('x', 'y', source=ds, hover_color='red')

Then, it is probably more bokeh issue rather than holoviews and it could be closed here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with large data using datashader — HoloViews v1.15.3
When viewed statically, the plots will not update fully when you zoom and pan. ... even with just 1000 points as in the...
Read more >
Plotting with Bokeh — HoloViews v1.15.3
In this section we will discover the different approaches to setting plot ... HoverTool(tooltips=tooltips) points.opts( tools=[hover], color='metal', ...
Read more >
Working with large data using datashader - HoloViews
When viewed statically, the plots will not update fully when you zoom and pan. ... even with just 1000 points as in the...
Read more >
Styling Mapping — HoloViews v1.15.3
Color cycles and styles are useful for categorical plots and when overlaying multiple ... Conversely, when mapping a categorical value into a set...
Read more >
Customizing Plots — HoloViews v1.15.3
Background: Setting the plot background color ... Axes: A set of axes provides scales describing the mapping between data and the space on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found