Extra hover columns for heatmap


Is hover_cols in hvplot.heatmap functional? It’s listed in the help, but nothing appears if I set it.

1 Like

Hi @isomerase

Welcome to the community. Could you post a small, reproducible example? It would make it much easier to help. Thanks.

I’ll try put one together (my current example is with RNA seq data). Basically, I just want extra columns in the tooltip when hovering over a cell.

1 Like

Here’s an easy way:

If you put your data into an xarray dataset like this:

Just call hvplot.heatmap on it, and pass the x,y, and z dimensions. Then, you can pass a HoverTool with tooltips, in which you can specify which metric to display on hover.

    clabel='Realized Volatility (%)',responsive=True,
                tooltips = [
                    ( "Time (UTC)",  "@date{%F}"),
                    ( "Pair", "@pair"),
                    ( "Realized Volatility (%)", "@sigma{0.00 a}"),
                    '@date':'datetime', # use 'datetime' formatter for 'date' field


So I figured out part of the problem. I was generating a heatmap based on a .copy() subset of columns without supplying x and y. Doing that gets the graph I want, but stupidly I forgot I was dropping the columns I want to use for hover_cols. But it seems you can’t supply of list of columns you want to use for x from the main pandas dataframe in .heatmap().

Is there a way to generate a heatmap like this:
by specifying what columns to use on the x-axis while keeping the whole dataframe, letting me pass other columns to hover_cols?

So now I’m trying to modify the underlying libraries to accept a subset of columns, but it’s not as trivial as I thought. If I try to control for x being a list of columns, I don’t understand where the call to base.py comes from.