☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

HoverTool not working with ColumnDataSource on Bokeh 2.2.3

Community Support
MarineBiologist
MarineBiologist

This is my code. I am able to plot the rays at 90 degrees but unfortunately HoverTool is not working with my code. The thing is at other places when I don’t use CDS, the HoverTool works fine but whenever I explicitly declare a CDS, HoverTool fails to work. I am not sure what I am doing wrong.

Also, I am aware CDS is implicitly created whenever it isn’t explicitly created but HoverTool works fine when it is created implicitly.

    inc = df.Type > 0
    dec = ~inc
    INC_COLOR = '#35762E'
    DEC_COLOR = '#C80000'

    inc_source = ColumnDataSource(data=dict(
        x1=df.Position[inc],
        pattern1=df.Pattern[inc]
    ))
    dec_source = ColumnDataSource(data=dict(
        x2=df.Position[dec],
        pattern2=df.Pattern[dec]
    ))
#minVal is a scalar like 340.0
    incFig = fig.ray(x='x1', y=minVal, source=inc_source, length=0, angle=90, angle_units="deg", color=INC_COLOR, name="patterns1")
    decFig = fig.ray(x='x2', y=minVal, source=dec_source, length=0, angle=90, angle_units="deg", color=DEC_COLOR, name="patterns2")

    fig.add_tools(HoverTool(
        renderers=[incFig],
        tooltips=[
            ("Patterns: ", "@pattern1")
        ],
        mode='hline'
        ))

    fig.add_tools(HoverTool(
        renderers=[decFig],
        tooltips=[
            ("Patterns: ", "@pattern2")
        ],
        mode='hline'
        ))
⌁   Link to post
carolyn
carolyn

Hi @MarineBiologist,

Your best bet at getting meaningful feedback is to include a minimal, reproducible example-- this means a simplified (and genericized where necessary) version of your code that someone else could copy and run locally in its entirely (so any data structures and import statements are all included) and see the same problems you’re seeing.

⌁   Link to post
Bryan
Bryan

Sorry I have been out of power most of the weekend. In this case the answer is simply that the Ray glyph does not currently support any of the hit-testing methods:

which means that the HoverTool does not function with ray glyphs. Current alternatives would be segment or line glyphs, which both support “point” and “span” hit-testing.

Adding hit-testing to ray would be a nice self-contained first issue for a new contributor, in case you have any interest in becoming involved in Bokeh development.

⌁   Link to post

End of archived discussion · Replies are disabled