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, > ryansp...@gmail.com 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 bokeh+un...@continuum.io
.
To post to this group, send email to bo...@continuum.io
.
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
