☰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

Tool specification - adding a hover tool with custom specification

Community Support
dbk
dbk

I am trying to add a hover tool that has a custom tooltip:

hover = HoverTool(

tooltips=[

(“Funding”, “(@y{int})”)

]

)

However, when I add the hover tool to the list of tools associated with the plot I get a default tooltip associated with the HoverTool rather than my tooltip. I am adding the HoverTool as follows:

p3.add_tools(hover())

Could someone please tell me what I am doing wrong?

Thanks!

⌁   Link to post
Bryan
Bryan

Hi,

Can you tell me where you saw an example or reference for the "{int}" syntax you are using? I am not sure that that is valid syntax, which might be an issue. Otherwise it looks fine, can you try it without the "{int}" and see if it makes a difference? And if not, can you provide a complete minimal example that can be run that demonstrates the issue?

Thanks,

Bryan

···

On Dec 30, 2015, at 2:42 PM, dbk@creare.com wrote:

I am trying to add a hover tool that has a custom tooltip:

hover = HoverTool(
        tooltips=[
            ("Funding", "(@y{int})")
        ]
    )

However, when I add the hover tool to the list of tools associated with the plot I get a default tooltip associated with the HoverTool rather than my tooltip. I am adding the HoverTool as follows:

p3.add_tools(hover())

Could someone please tell me what I am doing wrong?

Thanks!

--
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/d99a53f6-47f5-4d02-a1f8-55afcdaa395a%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
kynor.shop
kynor.shop

Hi Bryan,

Thanks for your note. This seems to be getting more complicated… I tried running the script on another computer and am now getting a different error (below). Seems like something is wrong with the add_tools function or there is a problem with duplication of the name ‘hover’?

File “/Users/davidkynor/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py”, line 699, in runfile

execfile(filename, namespace)

File “/Users/davidkynor/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py”, line 81, in execfile

builtins.execfile(filename, *where)

File “/Users/davidkynor/Desktop/DBK Project Funding/dbkFinance.py”, line 125, in

p3.add_tools(hover())

TypeError: ‘HoverTool’ object is not callable

This error occurs both with and without the {int} specification. The original code did not change…

···

On Wednesday, December 30, 2015 at 8:17:23 PM UTC-5, d...@creare.com wrote:

I am trying to add a hover tool that has a custom tooltip:

hover = HoverTool(

tooltips=[

(“Funding”, “(@y{int})”)

]

)

However, when I add the hover tool to the list of tools associated with the plot I get a default tooltip associated with the HoverTool rather than my tooltip. I am adding the HoverTool as follows:

p3.add_tools(hover())

Could someone please tell me what I am doing wrong?

Thanks!

⌁   Link to post
kynor.shop
kynor.shop

Bryan,

Here is where I saw mention of the {int} specification: http://stackoverflow.com/questions/28999411/how-to-show-integer-not-float-with-hover-tooltip-in-bokeh

Thanks!

···

On Wednesday, December 30, 2015 at 8:17:23 PM UTC-5, d...@creare.com wrote:

I am trying to add a hover tool that has a custom tooltip:

hover = HoverTool(

tooltips=[

(“Funding”, “(@y{int})”)

]

)

However, when I add the hover tool to the list of tools associated with the plot I get a default tooltip associated with the HoverTool rather than my tooltip. I am adding the HoverTool as follows:

p3.add_tools(hover())

Could someone please tell me what I am doing wrong?

Thanks!

⌁   Link to post
Bryan
Bryan

Hi Kynor,

That problem is because you are calling

  p3.add_tools(hover()) # note extra parens

instead of

  p3.add_tools(hover)

I had assumed that was a typo in your earlier message (because you would see exactly the situation you are reporting now). "hover = HoverTool(...)" creates a hover tool object, so "hover" is a instance of a HoverTool object, which is not a callable function. You just should pass it directly to .add_tools()

Thanks,

Bryan

···

On Dec 31, 2015, at 8:30 AM, kynor.shop@gmail.com wrote:

Hi Bryan,

Thanks for your note. This seems to be getting more complicated.... I tried running the script on another computer and am now getting a different error (below). Seems like something is wrong with the add_tools function or there is a problem with duplication of the name 'hover'?

  File "/Users/davidkynor/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
    execfile(filename, namespace)

  File "/Users/davidkynor/anaconda/lib/python2.7/site-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
    builtins.execfile(filename, *where)

  File "/Users/davidkynor/Desktop/DBK Project Funding/dbkFinance.py", line 125, in <module>
    p3.add_tools(hover())

TypeError: 'HoverTool' object is not callable

This error occurs both with and without the {int} specification. The original code did not change......

On Wednesday, December 30, 2015 at 8:17:23 PM UTC-5, d...@creare.com wrote:
I am trying to add a hover tool that has a custom tooltip:

hover = HoverTool(
        tooltips=[
            ("Funding", "(@y{int})")
        ]
    )

However, when I add the hover tool to the list of tools associated with the plot I get a default tooltip associated with the HoverTool rather than my tooltip. I am adding the HoverTool as follows:

p3.add_tools(hover())

Could someone please tell me what I am doing wrong?

Thanks!

--
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/5d929d9f-f2cb-4d8d-aa2a-b0f50aac6d2b%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Bryan
Bryan

Thanks! It looks like the project is big enough that even I don't know about some things. :slight_smile: Would you mind making an issue on GitHub to ask that this be documented this better?

Bryan

···

On Dec 31, 2015, at 8:32 AM, kynor.shop@gmail.com wrote:

Bryan,

Here is where I saw mention of the {int} specification: http://stackoverflow.com/questions/28999411/how-to-show-integer-not-float-with-hover-tooltip-in-bokeh

Thanks!

On Wednesday, December 30, 2015 at 8:17:23 PM UTC-5, d...@creare.com wrote:
I am trying to add a hover tool that has a custom tooltip:

hover = HoverTool(
        tooltips=[
            ("Funding", "(@y{int})")
        ]
    )

However, when I add the hover tool to the list of tools associated with the plot I get a default tooltip associated with the HoverTool rather than my tooltip. I am adding the HoverTool as follows:

p3.add_tools(hover())

Could someone please tell me what I am doing wrong?

Thanks!

--
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/f5000019-b045-4901-96d2-9cbbf731fbab%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
kynor.shop
kynor.shop

Hi Bryan,

You nailed it regarding my syntax error. Thanks!

Will open an issue on github requested better documentation when I’m back in the office next week.

Happy New Year!

-Dave

···

On Wednesday, December 30, 2015 at 8:17:23 PM UTC-5, d...@creare.com wrote:

I am trying to add a hover tool that has a custom tooltip:

hover = HoverTool(

tooltips=[

(“Funding”, “(@y{int})”)

]

)

However, when I add the hover tool to the list of tools associated with the plot I get a default tooltip associated with the HoverTool rather than my tooltip. I am adding the HoverTool as follows:

p3.add_tools(hover())

Could someone please tell me what I am doing wrong?

Thanks!

⌁   Link to post

End of archived discussion · Replies are disabled