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.

hover_color only works for the last GlyphRenderer

See original GitHub issue

ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)

Bokeh 0.12.13, Python 3.5, notebook 5.2.1, windows 10, Chrome

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

from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
from bokeh.io import show, output_notebook
output_notebook()

source = ColumnDataSource(data=dict(x=[1, 2, 3], y0=[1, 2, 3], y1=[-1, -2, -3]))
fig = figure(tools="hover", plot_width=500, plot_height=300, title=None)
c1 = fig.circle('x', 'y0', size=10, hover_color="firebrick", source=source)
c2 = fig.circle('x', 'y1', size=10, hover_color="firebrick", source=source)
show(fig)

Screenshots or screencasts of the bug in action

when mouse is over c1:

chrome_2018-01-11_12-53-43

when mouse is over c2:

chrome_2018-01-11_12-54-18

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
clairetang6commented, Mar 12, 2018

This issue is caused by the hover tool overwriting a data source’s inspected property each time a renderer is hit test against. I think the solution would be to have inspected be a dict of selections with renderers are keys instead of a single selection. (EDIT [March 11, 2018]: I no longer think this. inspected can be a single selection with the same semantics as selected. There is a single inspection for a whole data source. If a point is hovered and the inspection is set, then all data in that row is “inspected”.)

@ruoyu0088, as a workaround, you can use different sources for each of the renderers:

from bokeh.models import ColumnDataSource
from bokeh.plotting import figure
from bokeh.io import show

source1 = ColumnDataSource(data=dict(x=[1, 2, 3], y0=[1, 2, 3]))
source2 = ColumnDataSource(data=dict(x=[1, 2, 3], y1=[-1, -2, -3]))

fig = figure(tools="hover", plot_width=500, plot_height=300, title=None)
c1 = fig.circle('x', 'y0', size=10, hover_color="firebrick", source=source1)
c2 = fig.circle('x', 'y1', size=10, hover_color="firebrick", source=source2)
show(fig)
0reactions
maaxxwell1commented, Apr 12, 2021

I have recently come across this issue as well as I am working with dashboards which slice data contained in one big pandas data frame, and have been invited to comment on this thread - see details of my experience here:

https://discourse.bokeh.org/t/bokeh-linked-scatter-charts-with-cdsview-source-data-hover-color-only-works-on-the-last-glyph-in-figure/7603

Please let us know as and when a fix for this is in the pipeline. Many thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bokeh linked scatter charts with CDSView source data
The issue is that the hover color (gold) which identifies data points across the two charts (linked brushing) only works for the last...
Read more >
Bokeh linked scatter charts with CDSView source data
The issue is that the hover color (gold) which identifies data points across the two charts (linked brushing) only works for the last...
Read more >
CSS Button Style – Hover, Color, and Background
In this article you'll see how to style a button using CSS. My goal here is mostly to showcase how different CSS rules...
Read more >
Python Bar.select Examples - Python Code Examples - HotExamples
I would rather have the plots work all the time but really slow # then have ... in barchart.select(GlyphRenderer): if renderer.data_source.data['height'] !=
Read more >
Solved: How to change hover color on button
I've played with the hover function... but whenever I use it, it only changes the color of the text. Any suggestions? Thank you,...
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