[bokeh] Heatmap Hover Tool


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.




On Jul 19, 2018, at 01:32, Rob Robinson <[email protected]> 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}')

    fig = figure(x_range=[0,x_Map_Limit], y_range=[0,y_Map_Limit],tools=toolset)
    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 [email protected].
To post to this group, send email to [email protected].
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.