☰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

[bokeh] Heatmap Hover Tool

Community Support
Bryan
Bryan

Hi,

Tooltips for images are a very recent addition, only one or two releases old. Is your version of Bokeh new enough? It's always good to state version information in any question.

Thanks,

Bryan

···

On Jul 19, 2018, at 01:32, Rob Robinson <robinson.robert1995@gmail.com> wrote:

I am trying to create a hover function which displays the numerical value of that point in a heatmap, ( The x and y values display correctly however the value of the data point displays as ???. The data that is passed is a 2D np array. I'm guessing that I need to convert my data into a ColumnDataSource but unsure how to do this for a 2D array.
Any advice is appreciated.

def create_heatmap(data):

    color_mapper = LinearColorMapper(palette="Viridis256",low=1, high=500)
    color_bar = ColorBar(color_mapper=color_mapper, ticker=BasicTicker(),
                     label_standoff=12, border_line_color=None, location=(0,0))

    hover = HoverTool(show_arrow=False)
    hover.tooltips = [("x_Consumption", "$x"),
                    ("y_Consumption", "$y"),
                    ('Value', '@data{0.2f}')

                 ]
    toolset=[hover,"box_zoom","pan","wheel_zoom","undo","redo","reset","save","crosshair"]
    fig = figure(x_range=[0,x_Map_Limit], y_range=[0,y_Map_Limit],tools=toolset)
    fig.add_layout(color_bar,'right')
    fig.xaxis.axis_label = "Electricity Consumption"
    fig.yaxis.axis_label = "Gas Consumption"
    fig.image([data], x=0,y=0,dw=x_Map_Limit,dh=y_Map_Limit,color_mapper=color_mapper)
    return fig

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/79a8187f-f4c7-47ce-a467-54e790ead0f5%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled