How to change the content of some tool button tooltip in a plot toolbar?












0















I currently have two HoverTools for two different shapes in my plot, and in the Tool Panel, it's not possible to distinguish the HoverTool of booth shape.



There is any way to change the tool name from "Hover" to something else?



An other option is to hide booth tools from the Tool Panel, is it possible?



Tool Title



plot = figure(tools='pan,wheel_zoom,save', active_scroll = "wheel_zoom", x_axis_location=None, y_axis_location=None, output_backend="webgl", plot_width=1200, plot_height= 600, match_aspect=True )

plot.add_tools(HoverTool(renderers=[shape1], tooltips=[('title1',"text1")]))
plot.add_tools(HoverTool(renderers=[shape2], tooltips=[('title2',"text2")]))









share|improve this question





























    0















    I currently have two HoverTools for two different shapes in my plot, and in the Tool Panel, it's not possible to distinguish the HoverTool of booth shape.



    There is any way to change the tool name from "Hover" to something else?



    An other option is to hide booth tools from the Tool Panel, is it possible?



    Tool Title



    plot = figure(tools='pan,wheel_zoom,save', active_scroll = "wheel_zoom", x_axis_location=None, y_axis_location=None, output_backend="webgl", plot_width=1200, plot_height= 600, match_aspect=True )

    plot.add_tools(HoverTool(renderers=[shape1], tooltips=[('title1',"text1")]))
    plot.add_tools(HoverTool(renderers=[shape2], tooltips=[('title2',"text2")]))









    share|improve this question



























      0












      0








      0








      I currently have two HoverTools for two different shapes in my plot, and in the Tool Panel, it's not possible to distinguish the HoverTool of booth shape.



      There is any way to change the tool name from "Hover" to something else?



      An other option is to hide booth tools from the Tool Panel, is it possible?



      Tool Title



      plot = figure(tools='pan,wheel_zoom,save', active_scroll = "wheel_zoom", x_axis_location=None, y_axis_location=None, output_backend="webgl", plot_width=1200, plot_height= 600, match_aspect=True )

      plot.add_tools(HoverTool(renderers=[shape1], tooltips=[('title1',"text1")]))
      plot.add_tools(HoverTool(renderers=[shape2], tooltips=[('title2',"text2")]))









      share|improve this question
















      I currently have two HoverTools for two different shapes in my plot, and in the Tool Panel, it's not possible to distinguish the HoverTool of booth shape.



      There is any way to change the tool name from "Hover" to something else?



      An other option is to hide booth tools from the Tool Panel, is it possible?



      Tool Title



      plot = figure(tools='pan,wheel_zoom,save', active_scroll = "wheel_zoom", x_axis_location=None, y_axis_location=None, output_backend="webgl", plot_width=1200, plot_height= 600, match_aspect=True )

      plot.add_tools(HoverTool(renderers=[shape1], tooltips=[('title1',"text1")]))
      plot.add_tools(HoverTool(renderers=[shape2], tooltips=[('title2',"text2")]))






      python python-3.x hover tooltip bokeh






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 16:10









      ChesuCR

      5,58732153




      5,58732153










      asked Nov 18 '18 at 16:20









      Miguel GonçalvesMiguel Gonçalves

      153




      153
























          2 Answers
          2






          active

          oldest

          votes


















          0














          For your second question




          An other option is to hide booth tools from the Tool Panel, is it possible?




          I have already answered a similar question here:




          Just set the toggleable attribute to False. Check this example, where the hover tool button is hidden:




          from bokeh.models import HoverTool, ColumnDataSource, LassoSelectTool, PanTool
          from bokeh.plotting import show, figure, curdoc

          source = ColumnDataSource(dict(
          x=[1, 2, 3, 4],
          y=[5, 6, 7, 8]
          ))

          p = figure(
          width=400,
          height=400,
          tools='')

          p.scatter(
          x='x', y='y', source=source,
          fill_alpha=1.0, line_alpha=1.0, line_color="grey",
          size=6
          )

          pan = PanTool()
          lasso = LassoSelectTool()

          tooltips = '''
          <b>X: </b> @{x} <br>
          <b>Y: </b> @{y} <br>
          '''
          hover = HoverTool(
          toggleable=False, # add this to all your hover tools
          mode='mouse',
          tooltips=tooltips,
          )

          tools = (
          pan, lasso, hover
          )
          p.add_tools(*tools)

          curdoc().add_root(p)





          share|improve this answer
























          • "toggleable=False" made all the difference. It worked perfectly. Thanks for your anwser!

            – Miguel Gonçalves
            Nov 24 '18 at 19:07











          • OK @MiguelGonçalves you are welcome. If the answer was helpful please vote it, thank you

            – ChesuCR
            Nov 25 '18 at 12:35



















          0














          You can explicitly name the tools like this:



          tools=['pan', 'box_zoom', 'wheel_zoom', 'crosshair', 'reset', 'save']
          plot = figure(tools=tools, active_scroll = "wheel_zoom", x_axis_location=None, y_axis_location=None, output_backend="webgl", plot_width=1200, plot_height= 600, match_aspect=True )

          shape1 = plot.line([0,1],[2,3])
          shape2 = plot.line([4,5],[6,7])

          h1 = HoverTool(renderers=[shape1], tooltips=[('title1',"text1")])
          h2 = HoverTool(renderers=[shape2], tooltips=[('title2',"text2")])

          plot.add_tools(h1, h2)


          Another note - if you put h1 and h2 in the initial list where you declare the tools, you will get a warning saying duplicate hover tools. I haven't seen this warning to cause an issue though.






          share|improve this answer
























          • Thank you for your reply. I was actually trying to change the "Hover" label (in the image attached). Since i have 2 hover buttons in the tool panel, I cannot distinguish which is the right button for each shape.

            – Miguel Gonçalves
            Nov 20 '18 at 17:11











          • Gotcha. I looked into this a bit more....the "Hover" label in the toolbar seems to be defined in the Bokeh JS. You can download this in your output file by specifying output_file(filename, mode='inline'). If you search for "Hover" you will find a line that specifies "e.tool_name="Hover"". I tried changing this to "Hover1" and changing it once changed both hover tool names to Hover1. So I'm not sure what you're trying to do is currently possible, unless maybe you are really good with JS...

            – Jeff Shak
            Nov 22 '18 at 12:59













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53362985%2fhow-to-change-the-content-of-some-tool-button-tooltip-in-a-plot-toolbar%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          For your second question




          An other option is to hide booth tools from the Tool Panel, is it possible?




          I have already answered a similar question here:




          Just set the toggleable attribute to False. Check this example, where the hover tool button is hidden:




          from bokeh.models import HoverTool, ColumnDataSource, LassoSelectTool, PanTool
          from bokeh.plotting import show, figure, curdoc

          source = ColumnDataSource(dict(
          x=[1, 2, 3, 4],
          y=[5, 6, 7, 8]
          ))

          p = figure(
          width=400,
          height=400,
          tools='')

          p.scatter(
          x='x', y='y', source=source,
          fill_alpha=1.0, line_alpha=1.0, line_color="grey",
          size=6
          )

          pan = PanTool()
          lasso = LassoSelectTool()

          tooltips = '''
          <b>X: </b> @{x} <br>
          <b>Y: </b> @{y} <br>
          '''
          hover = HoverTool(
          toggleable=False, # add this to all your hover tools
          mode='mouse',
          tooltips=tooltips,
          )

          tools = (
          pan, lasso, hover
          )
          p.add_tools(*tools)

          curdoc().add_root(p)





          share|improve this answer
























          • "toggleable=False" made all the difference. It worked perfectly. Thanks for your anwser!

            – Miguel Gonçalves
            Nov 24 '18 at 19:07











          • OK @MiguelGonçalves you are welcome. If the answer was helpful please vote it, thank you

            – ChesuCR
            Nov 25 '18 at 12:35
















          0














          For your second question




          An other option is to hide booth tools from the Tool Panel, is it possible?




          I have already answered a similar question here:




          Just set the toggleable attribute to False. Check this example, where the hover tool button is hidden:




          from bokeh.models import HoverTool, ColumnDataSource, LassoSelectTool, PanTool
          from bokeh.plotting import show, figure, curdoc

          source = ColumnDataSource(dict(
          x=[1, 2, 3, 4],
          y=[5, 6, 7, 8]
          ))

          p = figure(
          width=400,
          height=400,
          tools='')

          p.scatter(
          x='x', y='y', source=source,
          fill_alpha=1.0, line_alpha=1.0, line_color="grey",
          size=6
          )

          pan = PanTool()
          lasso = LassoSelectTool()

          tooltips = '''
          <b>X: </b> @{x} <br>
          <b>Y: </b> @{y} <br>
          '''
          hover = HoverTool(
          toggleable=False, # add this to all your hover tools
          mode='mouse',
          tooltips=tooltips,
          )

          tools = (
          pan, lasso, hover
          )
          p.add_tools(*tools)

          curdoc().add_root(p)





          share|improve this answer
























          • "toggleable=False" made all the difference. It worked perfectly. Thanks for your anwser!

            – Miguel Gonçalves
            Nov 24 '18 at 19:07











          • OK @MiguelGonçalves you are welcome. If the answer was helpful please vote it, thank you

            – ChesuCR
            Nov 25 '18 at 12:35














          0












          0








          0







          For your second question




          An other option is to hide booth tools from the Tool Panel, is it possible?




          I have already answered a similar question here:




          Just set the toggleable attribute to False. Check this example, where the hover tool button is hidden:




          from bokeh.models import HoverTool, ColumnDataSource, LassoSelectTool, PanTool
          from bokeh.plotting import show, figure, curdoc

          source = ColumnDataSource(dict(
          x=[1, 2, 3, 4],
          y=[5, 6, 7, 8]
          ))

          p = figure(
          width=400,
          height=400,
          tools='')

          p.scatter(
          x='x', y='y', source=source,
          fill_alpha=1.0, line_alpha=1.0, line_color="grey",
          size=6
          )

          pan = PanTool()
          lasso = LassoSelectTool()

          tooltips = '''
          <b>X: </b> @{x} <br>
          <b>Y: </b> @{y} <br>
          '''
          hover = HoverTool(
          toggleable=False, # add this to all your hover tools
          mode='mouse',
          tooltips=tooltips,
          )

          tools = (
          pan, lasso, hover
          )
          p.add_tools(*tools)

          curdoc().add_root(p)





          share|improve this answer













          For your second question




          An other option is to hide booth tools from the Tool Panel, is it possible?




          I have already answered a similar question here:




          Just set the toggleable attribute to False. Check this example, where the hover tool button is hidden:




          from bokeh.models import HoverTool, ColumnDataSource, LassoSelectTool, PanTool
          from bokeh.plotting import show, figure, curdoc

          source = ColumnDataSource(dict(
          x=[1, 2, 3, 4],
          y=[5, 6, 7, 8]
          ))

          p = figure(
          width=400,
          height=400,
          tools='')

          p.scatter(
          x='x', y='y', source=source,
          fill_alpha=1.0, line_alpha=1.0, line_color="grey",
          size=6
          )

          pan = PanTool()
          lasso = LassoSelectTool()

          tooltips = '''
          <b>X: </b> @{x} <br>
          <b>Y: </b> @{y} <br>
          '''
          hover = HoverTool(
          toggleable=False, # add this to all your hover tools
          mode='mouse',
          tooltips=tooltips,
          )

          tools = (
          pan, lasso, hover
          )
          p.add_tools(*tools)

          curdoc().add_root(p)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 16:08









          ChesuCRChesuCR

          5,58732153




          5,58732153













          • "toggleable=False" made all the difference. It worked perfectly. Thanks for your anwser!

            – Miguel Gonçalves
            Nov 24 '18 at 19:07











          • OK @MiguelGonçalves you are welcome. If the answer was helpful please vote it, thank you

            – ChesuCR
            Nov 25 '18 at 12:35



















          • "toggleable=False" made all the difference. It worked perfectly. Thanks for your anwser!

            – Miguel Gonçalves
            Nov 24 '18 at 19:07











          • OK @MiguelGonçalves you are welcome. If the answer was helpful please vote it, thank you

            – ChesuCR
            Nov 25 '18 at 12:35

















          "toggleable=False" made all the difference. It worked perfectly. Thanks for your anwser!

          – Miguel Gonçalves
          Nov 24 '18 at 19:07





          "toggleable=False" made all the difference. It worked perfectly. Thanks for your anwser!

          – Miguel Gonçalves
          Nov 24 '18 at 19:07













          OK @MiguelGonçalves you are welcome. If the answer was helpful please vote it, thank you

          – ChesuCR
          Nov 25 '18 at 12:35





          OK @MiguelGonçalves you are welcome. If the answer was helpful please vote it, thank you

          – ChesuCR
          Nov 25 '18 at 12:35













          0














          You can explicitly name the tools like this:



          tools=['pan', 'box_zoom', 'wheel_zoom', 'crosshair', 'reset', 'save']
          plot = figure(tools=tools, active_scroll = "wheel_zoom", x_axis_location=None, y_axis_location=None, output_backend="webgl", plot_width=1200, plot_height= 600, match_aspect=True )

          shape1 = plot.line([0,1],[2,3])
          shape2 = plot.line([4,5],[6,7])

          h1 = HoverTool(renderers=[shape1], tooltips=[('title1',"text1")])
          h2 = HoverTool(renderers=[shape2], tooltips=[('title2',"text2")])

          plot.add_tools(h1, h2)


          Another note - if you put h1 and h2 in the initial list where you declare the tools, you will get a warning saying duplicate hover tools. I haven't seen this warning to cause an issue though.






          share|improve this answer
























          • Thank you for your reply. I was actually trying to change the "Hover" label (in the image attached). Since i have 2 hover buttons in the tool panel, I cannot distinguish which is the right button for each shape.

            – Miguel Gonçalves
            Nov 20 '18 at 17:11











          • Gotcha. I looked into this a bit more....the "Hover" label in the toolbar seems to be defined in the Bokeh JS. You can download this in your output file by specifying output_file(filename, mode='inline'). If you search for "Hover" you will find a line that specifies "e.tool_name="Hover"". I tried changing this to "Hover1" and changing it once changed both hover tool names to Hover1. So I'm not sure what you're trying to do is currently possible, unless maybe you are really good with JS...

            – Jeff Shak
            Nov 22 '18 at 12:59


















          0














          You can explicitly name the tools like this:



          tools=['pan', 'box_zoom', 'wheel_zoom', 'crosshair', 'reset', 'save']
          plot = figure(tools=tools, active_scroll = "wheel_zoom", x_axis_location=None, y_axis_location=None, output_backend="webgl", plot_width=1200, plot_height= 600, match_aspect=True )

          shape1 = plot.line([0,1],[2,3])
          shape2 = plot.line([4,5],[6,7])

          h1 = HoverTool(renderers=[shape1], tooltips=[('title1',"text1")])
          h2 = HoverTool(renderers=[shape2], tooltips=[('title2',"text2")])

          plot.add_tools(h1, h2)


          Another note - if you put h1 and h2 in the initial list where you declare the tools, you will get a warning saying duplicate hover tools. I haven't seen this warning to cause an issue though.






          share|improve this answer
























          • Thank you for your reply. I was actually trying to change the "Hover" label (in the image attached). Since i have 2 hover buttons in the tool panel, I cannot distinguish which is the right button for each shape.

            – Miguel Gonçalves
            Nov 20 '18 at 17:11











          • Gotcha. I looked into this a bit more....the "Hover" label in the toolbar seems to be defined in the Bokeh JS. You can download this in your output file by specifying output_file(filename, mode='inline'). If you search for "Hover" you will find a line that specifies "e.tool_name="Hover"". I tried changing this to "Hover1" and changing it once changed both hover tool names to Hover1. So I'm not sure what you're trying to do is currently possible, unless maybe you are really good with JS...

            – Jeff Shak
            Nov 22 '18 at 12:59
















          0












          0








          0







          You can explicitly name the tools like this:



          tools=['pan', 'box_zoom', 'wheel_zoom', 'crosshair', 'reset', 'save']
          plot = figure(tools=tools, active_scroll = "wheel_zoom", x_axis_location=None, y_axis_location=None, output_backend="webgl", plot_width=1200, plot_height= 600, match_aspect=True )

          shape1 = plot.line([0,1],[2,3])
          shape2 = plot.line([4,5],[6,7])

          h1 = HoverTool(renderers=[shape1], tooltips=[('title1',"text1")])
          h2 = HoverTool(renderers=[shape2], tooltips=[('title2',"text2")])

          plot.add_tools(h1, h2)


          Another note - if you put h1 and h2 in the initial list where you declare the tools, you will get a warning saying duplicate hover tools. I haven't seen this warning to cause an issue though.






          share|improve this answer













          You can explicitly name the tools like this:



          tools=['pan', 'box_zoom', 'wheel_zoom', 'crosshair', 'reset', 'save']
          plot = figure(tools=tools, active_scroll = "wheel_zoom", x_axis_location=None, y_axis_location=None, output_backend="webgl", plot_width=1200, plot_height= 600, match_aspect=True )

          shape1 = plot.line([0,1],[2,3])
          shape2 = plot.line([4,5],[6,7])

          h1 = HoverTool(renderers=[shape1], tooltips=[('title1',"text1")])
          h2 = HoverTool(renderers=[shape2], tooltips=[('title2',"text2")])

          plot.add_tools(h1, h2)


          Another note - if you put h1 and h2 in the initial list where you declare the tools, you will get a warning saying duplicate hover tools. I haven't seen this warning to cause an issue though.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 19 '18 at 15:46









          Jeff ShakJeff Shak

          112




          112













          • Thank you for your reply. I was actually trying to change the "Hover" label (in the image attached). Since i have 2 hover buttons in the tool panel, I cannot distinguish which is the right button for each shape.

            – Miguel Gonçalves
            Nov 20 '18 at 17:11











          • Gotcha. I looked into this a bit more....the "Hover" label in the toolbar seems to be defined in the Bokeh JS. You can download this in your output file by specifying output_file(filename, mode='inline'). If you search for "Hover" you will find a line that specifies "e.tool_name="Hover"". I tried changing this to "Hover1" and changing it once changed both hover tool names to Hover1. So I'm not sure what you're trying to do is currently possible, unless maybe you are really good with JS...

            – Jeff Shak
            Nov 22 '18 at 12:59





















          • Thank you for your reply. I was actually trying to change the "Hover" label (in the image attached). Since i have 2 hover buttons in the tool panel, I cannot distinguish which is the right button for each shape.

            – Miguel Gonçalves
            Nov 20 '18 at 17:11











          • Gotcha. I looked into this a bit more....the "Hover" label in the toolbar seems to be defined in the Bokeh JS. You can download this in your output file by specifying output_file(filename, mode='inline'). If you search for "Hover" you will find a line that specifies "e.tool_name="Hover"". I tried changing this to "Hover1" and changing it once changed both hover tool names to Hover1. So I'm not sure what you're trying to do is currently possible, unless maybe you are really good with JS...

            – Jeff Shak
            Nov 22 '18 at 12:59



















          Thank you for your reply. I was actually trying to change the "Hover" label (in the image attached). Since i have 2 hover buttons in the tool panel, I cannot distinguish which is the right button for each shape.

          – Miguel Gonçalves
          Nov 20 '18 at 17:11





          Thank you for your reply. I was actually trying to change the "Hover" label (in the image attached). Since i have 2 hover buttons in the tool panel, I cannot distinguish which is the right button for each shape.

          – Miguel Gonçalves
          Nov 20 '18 at 17:11













          Gotcha. I looked into this a bit more....the "Hover" label in the toolbar seems to be defined in the Bokeh JS. You can download this in your output file by specifying output_file(filename, mode='inline'). If you search for "Hover" you will find a line that specifies "e.tool_name="Hover"". I tried changing this to "Hover1" and changing it once changed both hover tool names to Hover1. So I'm not sure what you're trying to do is currently possible, unless maybe you are really good with JS...

          – Jeff Shak
          Nov 22 '18 at 12:59







          Gotcha. I looked into this a bit more....the "Hover" label in the toolbar seems to be defined in the Bokeh JS. You can download this in your output file by specifying output_file(filename, mode='inline'). If you search for "Hover" you will find a line that specifies "e.tool_name="Hover"". I tried changing this to "Hover1" and changing it once changed both hover tool names to Hover1. So I'm not sure what you're trying to do is currently possible, unless maybe you are really good with JS...

          – Jeff Shak
          Nov 22 '18 at 12:59




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53362985%2fhow-to-change-the-content-of-some-tool-button-tooltip-in-a-plot-toolbar%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word