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.

[BUG]Annular Wedge Hovertools Dead Areas

See original GitHub issue

Encountered this several times on the previous version and current version of bokeh 1.4.0, where hovertool does not work on certain areas on annular wedge. Searched through cummunity support, only found this reported once @ https://discourse.bokeh.org/t/bokeh-bug-in-annular-wedge-wedge-hover-tooltip/2813/5

Below code to replicate the issues

import pandas as pd
import numpy as np
from bokeh.plotting import figure
from bokeh.io import show
from bokeh.models import HoverTool, ColumnDataSource
from bokeh.palettes import Category20
from bokeh.transform import cumsum


###->data
data = {"Code": [11,8,4,2,6,1,13,10,5,9],
        "Count": [820,277,272,164,94,67,62,53,17,2],
        "Rate": [0.4486,0.1515,0.1488,0.0897,0.0514,0.0367,0.0339,0.0290,0.0093,0.0011]}

hover_issue_demo_df = pd.DataFrame(data)
hover_issue_demo_df["Colour"] = Category20[len(hover_issue_demo_df["Code"])]
hover_issue_demo_df["cum_s"] = (hover_issue_demo_df["Rate"].cumsum().shift(1).fillna(0))*2*np.pi
hover_issue_demo_df["cum"] = (hover_issue_demo_df["Rate"].cumsum())*2*np.pi

###->CDS source
CDS_hover_issue_demo_df = ColumnDataSource(hover_issue_demo_df)

##->figure
p_hover_issue_demo_df = figure(plot_width=400, plot_height=400, title="Demo", x_range=(-0.5, 0.5), y_range=(-1, 1))

p_hover_issue_demo_df.annular_wedge(x=0, y=0, 
                                    inner_radius=0.2, outer_radius=0.35,
                                    source=CDS_hover_issue_demo_df,
                                    start_angle="cum_s", end_angle="cum", 
                                    color="Colour"
                                    )

###->add hovertool
hover = HoverTool(tooltips=[("Count", "@Count{0,0}"), ("Percentage", "@Rate{0.0000%}")], mode="mouse", point_policy="follow_mouse")
p_hover_issue_demo_df.add_tools(hover)

show(p_hover_issue_demo_df)

sample output where dead spots are.

bokeh_plot_hover issue

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
bryevdvcommented, Feb 16, 2020

More specifically, as with any circle-ish glyph, you probably always want to set match_aspect=True when you create a figure.

0reactions
mhlearncommented, Feb 17, 2020

In trying to create a minimal example I discovered the cause! A non-visible legend that was occluding the hover space.

Screen Shot 2020-02-16 at 6 54 03 PM

Sorry to bother you with this, and thank you for making such a wonder visualization library!

as mentioned in here too, https://discourse.bokeh.org/t/bokeh-bug-in-annular-wedge-wedge-hover-tooltip/2813/5 , non-visible legend can be the cause. other then set legend.visible=False, also the rest of following to avoid hovertool not display properly,

legend.glyph_height = 0 legend.glyph_width = 0 legend.label_height = 0

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bokeh] Bug in annular wedge/wedge hover tooltip
Hi everyone, I don't know if I state the obvious but I have a strange behavior in the annular wedge plot: Let's take...
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