bokeh: [BUG]Annular Wedge Hovertools Dead Areas

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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

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