HeatMap hover tooltip not showing up

Hi,
I am just learning Bokeh and struggling with some things. For example, how do I get the hover tooltip to show up on a HeatMap? I tried:

import pandas as pd
from bokeh.charts import HeatMap
from bokeh.plotting import output_file, show
from bokeh.models import HoverTool
tips = pd.read_csv('https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv')
hm = HeatMap(tips, x='sex', y='day', values='total_bill', stat='mean', hover_tool=True)
output_file("heatmap-tooltip.html", title="heatmap-tooltip")
show(hm)

But there is no tooltip, neither in the created file or in the Jupyter-notebook (I tried with output_notebook()).

I also tried briefly with adding tools=['hover'], but it did not work either. I am not sure I am doing this correctly as it seem like the syntax here differs from that used in bokeh.figure, where I could specify hover as a string in addition to as a list.

I would prefer to use HeatMap over the lower level examples in the bokeh gallery. Any pointers on how to fix this are much appreciated!

Cheers

I am also having this problem. It appears (i’m very very new to Bokeh) that the default hover functionality present in version 10, is now longer present in version 11.1. Or (more realistically) I haven’t the faintest clue how to get it working. I would also appreciate some advice on this.

···

On Saturday, June 18, 2016 at 12:17:00 PM UTC-4, Joel wrote:

Hi,
I am just learning Bokeh and struggling with some things. For example, how do I get the hover tooltip to show up on a HeatMap? I tried:

import pandas as pd
from bokeh.charts import HeatMap
from bokeh.plotting import output_file, show
from bokeh.models import HoverTool
tips = pd.read_csv('[https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv](https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv)')
hm = HeatMap(tips, x='sex', y='day', values='total_bill', stat='mean', hover_tool=True)
output_file("heatmap-tooltip.html", title="heatmap-tooltip")
show(hm)

But there is no tooltip, neither in the created file or in the Jupyter-notebook (I tried with output_notebook()).

I also tried briefly with adding tools=['hover'], but it did not work either. I am not sure I am doing this correctly as it seem like the syntax here differs from that used in bokeh.figure, where I could specify hover as a string in addition to as a list.

I would prefer to use HeatMap over the lower level examples in the bokeh gallery. Any pointers on how to fix this are much appreciated!

Cheers

hm1 =
HeatMap(autompg, x=bins(‘mpg’), y=bins(‘displ’),
tools=‘hover’)

works for me. hover is not a default
tool (I’m not sure if it was before and
was removed) but you can request it as above - more info here:

···

http://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#specifying-tools
On 6/22/16 9:19 AM,
wrote:

[email protected]

    I am also having this problem. It appears (i'm very

very new to Bokeh) that the default hover functionality present
in version 10, is now longer present in version 11.1. Or (more
realistically) I haven’t the faintest clue how to get it
working. I would also appreciate some advice on this.

    On Saturday, June 18, 2016 at 12:17:00 PM UTC-4, Joel wrote:

Hi,
I am just learning Bokeh and struggling with some
things. For example, how do I get the hover tooltip to
show up on a HeatMap? I tried:

import pandas as pd
from bokeh.charts import HeatMap
from bokeh.plotting import output_file, show
from bokeh.models import HoverTool
tips = pd.read_csv('[https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv](https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv)')
hm = HeatMap(tips, x='sex', y='day', values='total_bill', stat='mean', hover_tool=True)
output_file("heatmap-tooltip.html", title="heatmap-tooltip")
show(hm)

But there is no tooltip, neither in the created file or in the Jupyter-notebook (I tried with output_notebook()).

I also tried briefly with adding tools=['hover'], but it did not work either. I am not sure I am doing this correctly as it seem like the syntax here differs from that used in bokeh.figure, where I could specify hover as a string in addition to as a list.

I would prefer to use HeatMap over the lower level examples in the bokeh gallery. Any pointers on how to fix this are much appreciated!

Cheers

– 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/6da0426e-dc57-44e7-9241-e86329a23d2c%40continuum.io
.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Sarah Bird
Developer, Bokeh



Hi Sarah,

Thank you very much for the information. I really appreciate it.

Have a great day.

Best,
Ryan

···

On Jun 22, 2016 1:24 PM, “Sarah Bird - Continuum” [email protected] wrote:

      hm1 =

HeatMap(autompg, x=bins(‘mpg’), y=bins(‘displ’),
tools=‘hover’)

works for me. hover is not a default
tool (I’m not sure if it was before and
was removed) but you can request it as above - more info here:
http://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#specifying-tools

  On 6/22/16 9:19 AM, > [email protected] wrote:
    I am also having this problem. It appears (i'm very

very new to Bokeh) that the default hover functionality present
in version 10, is now longer present in version 11.1. Or (more
realistically) I haven’t the faintest clue how to get it
working. I would also appreciate some advice on this.

    On Saturday, June 18, 2016 at 12:17:00 PM UTC-4, Joel wrote:

Hi,
I am just learning Bokeh and struggling with some
things. For example, how do I get the hover tooltip to
show up on a HeatMap? I tried:

import pandas as pd
from bokeh.charts import HeatMap
from bokeh.plotting import output_file, show
from bokeh.models import HoverTool
tips = pd.read_csv('[https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv](https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv)')
hm = HeatMap(tips, x='sex', y='day', values='total_bill', stat='mean', hover_tool=True)
output_file("heatmap-tooltip.html", title="heatmap-tooltip")
show(hm)

But there is no tooltip, neither in the created file or in the Jupyter-notebook (I tried with output_notebook()).

I also tried briefly with adding tools=['hover'], but it did not work either. I am not sure I am doing this correctly as it seem like the syntax here differs from that used in bokeh.figure, where I could specify hover as a string in addition to as a list.

I would prefer to use HeatMap over the lower level examples in the bokeh gallery. Any pointers on how to fix this are much appreciated!

Cheers

– 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/6da0426e-dc57-44e7-9241-e86329a23d2c%40continuum.io
.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Sarah Bird
Developer, Bokeh



You received this message because you are subscribed to a topic in the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/Yd_HumyAs78/unsubscribe.

To unsubscribe from this group and all its topics, 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/44fb256d-30ea-84f4-1790-c00e49311a07%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Sarah (and/or anyone else stumbling on this),

Would you have any insight into the ColumnDataSource class?

The default hover values are not what I need, and I am attempting to change them. However when I make use of the ColumnDataSource class as mentioned in the Bokeh documentation (under ‘specify tools’ which you kindly linked), I receive a “TypeError: ‘NoneType’ object is not subscriptable” error when calling the HeatMap chart. I am stumped as to why it is doing this, as the HeatMap is generated just fine (but without the proper hover information) when I pass the straight df (not the ColumnDataSource object). I appears I am not understanding the role that ColumnDataSource plays, nor how to properly make use of it.

I am looking for the hover tool to display:

Branch: Branch Name

Exceptions: Exceptions Value (#)

I would appreciate any help you could provide.

from bokeh.plotting import figure, output_notebook, show, ColumnDataSource

from bokeh.models import HoverTool

df = pd.read_excel(‘branchtest.xlsx’)

source = ColumnDataSource(df)

hover = HoverTool(

tooltips=[

(“branch”, “@Branch”),

(“exceptions”, “@Exceptions”),

]

)

hm = HeatMap(source, x=‘Date’, y=‘Branch’, values=‘Exceptions’, stat=None, tools = [hover])

show(hm)

``

Note: the source file/df contains the following test data:

···

On Wednesday, June 22, 2016 at 1:24:52 PM UTC-4, Sarah Bird wrote:

      hm1 =

HeatMap(autompg, x=bins(‘mpg’), y=bins(‘displ’),
tools=‘hover’)

works for me. hover is not a default
tool (I’m not sure if it was before and
was removed) but you can request it as above - more info here:
http://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#specifying-tools

  On 6/22/16 9:19 AM, > [email protected] wrote:
    I am also having this problem. It appears (i'm very

very new to Bokeh) that the default hover functionality present
in version 10, is now longer present in version 11.1. Or (more
realistically) I haven’t the faintest clue how to get it
working. I would also appreciate some advice on this.

    On Saturday, June 18, 2016 at 12:17:00 PM UTC-4, Joel wrote:

Hi,
I am just learning Bokeh and struggling with some
things. For example, how do I get the hover tooltip to
show up on a HeatMap? I tried:

import pandas as pd
from bokeh.charts import HeatMap
from bokeh.plotting import output_file, show
from bokeh.models import HoverTool
tips = pd.read_csv('[https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv](https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv)')
hm = HeatMap(tips, x='sex', y='day', values='total_bill', stat='mean', hover_tool=True)
output_file("heatmap-tooltip.html", title="heatmap-tooltip")
show(hm)

But there is no tooltip, neither in the created file or in the Jupyter-notebook (I tried with output_notebook()).

I also tried briefly with adding tools=['hover'], but it did not work either. I am not sure I am doing this correctly as it seem like the syntax here differs from that used in bokeh.figure, where I could specify hover as a string in addition to as a list.

I would prefer to use HeatMap over the lower level examples in the bokeh gallery. Any pointers on how to fix this are much appreciated!

Cheers

– 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/6da0426e-dc57-44e7-9241-e86329a23d2c%40continuum.io
.
For more options, visit https://groups.google.com/a/continuum.io/d/optout

.

Sarah Bird
Developer, Bokeh


Continuum Analytics

Hi,

                I'm guessing that the None error is to do wi                                th

stat=None, not Hover.

        B                ut

there are some tricks with charts and hover :
??

···

https://github.com/bokeh/bokeh/issues/4347

                                                      If you're just

learning Bo keh
I would highly re commend starting with an example
and then just changing on e thing at a
time.

                                  Best,

                                    BIrd

   On 6/22/16 12:31 PM,

wrote:

[email protected]

Hi Sarah (and/or anyone else stumbling on this),

Would you have any insight into the ColumnDataSource class?

      The default hover values are not what I need, and I am

attempting to change them. However when I make use of the
ColumnDataSource class as mentioned in the Bokeh documentation
(under ‘specify tools’ which you kindly linked), I receive a
“TypeError: ‘NoneType’ object is not subscriptable” error when
calling the HeatMap chart. I am stumped as to why it is doing
this, as the HeatMap is generated just fine (but without the
proper hover information) when I pass the straight df (not the
ColumnDataSource object). I appears I am not understanding the
role that ColumnDataSource plays, nor how to properly make use
of it.

I am looking for the hover tool to display:

Branch: Branch Name

Exceptions: Exceptions Value (#)

I would appreciate any help you could provide.

                from bokeh.plotting import

figure, output_notebook, show, ColumnDataSource

                from bokeh.models import

HoverTool

                df =

pd.read_excel(‘branchtest.xlsx’)

                source =

ColumnDataSource(df)

hover = HoverTool(

tooltips=[

                ("branch",

@Branch”),

                ("exceptions",

@Exceptions”),

]

)

                  hm =

HeatMap(source, x=‘Date’, y=‘Branch’,
values=‘Exceptions’, stat=None, tools = [hover])

show(hm)

``

      Note: the source file/df contains the following test data:

      On Wednesday, June 22, 2016 at 1:24:52 PM UTC-4, Sarah Bird

wrote:

                hm1 =

HeatMap(autompg, x=bins(‘mpg’), y=bins(‘displ’),
tools=‘hover’)

works for me. hover is not a default tool (I’m not sure if it was
before and was removed) but you can request it as
above - more
info here:
http://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#specifying-tools

On 6/22/16 9:19 AM, [email protected]
wrote:

              I am also having this problem. It appears

(i’m very very new to Bokeh) that the default hover
functionality present in version 10, is now longer
present in version 11.1. Or (more realistically) I
haven’t the faintest clue how to get it working. I
would also appreciate some advice on this.

              On Saturday, June 18, 2016 at 12:17:00 PM UTC-4, Joel

wrote:

Hi,
I am just learning Bokeh and struggling with
some things. For example, how do I get the
hover tooltip to show up on a HeatMap? I
tried:

import pandas as pd
from bokeh.charts import HeatMap
from bokeh.plotting import output_file, show
from bokeh.models import HoverTool
tips = pd.read_csv('[https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv](https://raw.githubusercontent.com/pydata/pandas/master/pandas/tests/data/tips.csv)')
hm = HeatMap(tips, x='sex', y='day', values='total_bill', stat='mean', hover_tool=True)
output_file("heatmap-tooltip.html", title="heatmap-tooltip")
show(hm)

But there is no tooltip, neither in the created file or in the Jupyter-notebook (I tried with output_notebook()).

I also tried briefly with adding tools=['hover'], but it did not work either. I am not sure I am doing this correctly as it seem like the syntax here differs from that used in bokeh.figure, where I could specify hover as a string in addition to as a list.

I would prefer to use HeatMap over the lower level examples in the bokeh gallery. Any pointers on how to fix this are much appreciated!

Cheers

– 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/6da0426e-dc57-44e7-9241-e86329a23d2c%40continuum.io
.
For more options, visit https://groups.google.com/a/continuum.io/d/optout

.

Sarah Bird
Developer, Bokeh


Continuum Analytics

– 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/b301e72e-2dde-470b-9715-623f2dfe8344%40continuum.io
.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Sarah Bird
Developer, Bokeh



Hi Sarah (and anyone else who could help),

I have spent some time to recreate HeatMaps using the examples provided without much issue. However, the examples do not explicitly specify how to add custom hover information to a HeatMap. I have read the user guide and I just can't seem to figure it out.

If I pass the df to HeatMap (without passing it first to ColumnDataSource) it partially works in that it shows the interval the value is part of. Apparently HeatMap creates another column to the data frame with intervals (I'm assuming to guide the colouring) using the same name as the original values column. It then renames the original values column by appending '_values' to the end of the name. I have tried to change the hover tool to point to the '_values' column to show the values, but that does not work.

If I pass the ColumnDataSource object, I get the same error as above.

I am having no problems creating custom over information with other chart types.

If anyone could help I would greatly appreciate it!