[BUG]Annular Wedge Hovertools Dead Areas
See original GitHub issueEncountered 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (9 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
More specifically, as with any circle-ish glyph, you probably always want to set
match_aspect=True
when you create afigure
.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