question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

interaction between tooltips and gridplots

See original GitHub issue

I tried to build a grid plot involving tooltips. The result was that, if the tooltips display was not contained in the figure associated to it, it was truncated by the figure to the right and below as in the following example. However, it does not get truncated by figures above or to the left:

Screenshot

This one is truncated image

This one is not: image

Code

import numpy
from bokeh.plotting import figure, show, output_file
from bokeh.plotting import figure, output_file, show, ColumnDataSource
from bokeh.sampledata.iris import flowers
from bokeh.io import gridplot
from bokeh.models import HoverTool

df = flowers.copy()
df['cat_col'] = numpy.round(flowers.petal_width * 2)

colormap = {'setosa': 'red', 'versicolor': 'green', 'virginica': 'blue'}
colors = [colormap[x] for x in df['species']]

result = []
for species in df['species'].unique():
    sub_res = []
    for cat in df['cat_col'].unique():
        sub_df = df[(df['species'] == species) & (df['cat_col'] == cat)]
        colors = [colormap[x] for x in sub_df['species']]
        hoverdata = ['species:{} - cat:{}'.format(species, cat) for x in sub_df['species']]
        source = ColumnDataSource(data=dict(hovercol=hoverdata))

        hover = HoverTool(tooltips=[("Hover col", "@hovercol"),])
        p = figure(tools=[hover])
        p.circle(sub_df["petal_length"], sub_df["petal_width"],
                 color=colors, fill_alpha=0.2, size=10, source=source)
        sub_res.append(p)
    result.append(sub_res)


output_file("iris.html", title="iris.py example")

show(gridplot(result, plot_width=200, plot_height=200))

Bokeh version

Python version : 3.4.3 |Continuum Analytics, Inc.| (default, Dec 1 2015, 11:59:33) [MSC v.1600 32 bit (Intel)] IPython version : 4.0.0 Bokeh version : 0.12.1

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:20 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
birdsarahcommented, Aug 8, 2016

Another option which doesn’t fix it, but may help, would be to implement hover in a fixed position, like on this leaflet demo: http://leafletjs.com/examples/choropleth.html

screen shot 2016-08-08 at 2 43 59 pm
1reaction
bryevdvcommented, Feb 24, 2020

My guess is, if Bokeh on the Python side is upgraded to 2.0.0, then BokehJS on the JS side should also be 2.0.0 to be able to parse the JSON but I could not find a corresponding version for BokehJS to test

Yes versions definitely JS/Python need to match, in general. Not just between major releases, either. Are you intending to hard code a fixed BokehJS version but accept JSON output from arbitrary Python Bokeh versions? I would not regard that as reliable.

Do you plan to also release a BokehJS 2.0.0rc1 on npm for downstream projects to test Bokeh embedding ?

I had not planned on it. Until now, we only publish full releases to NPM. This is certainly something we can consider changing in the future, especially if there is increased interest in the NPM package. Given the compressed schedule to 2.0 this week I am not sure it’s worth it for me to scramble to do something different in the middle of release week. But we can have a very quick 2.0.1 if there are any follow-on issues.

Do you eventually have a migration guide to 2.0.0 ?

Each release has its own (if any) migration notes:

https://docs.bokeh.org/en/dev/docs/releases.html

That said, while we do our best, we only put in what we think to put in based on the use cases we know about, so there may be things that are missed for some people.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hover tool renderer level - Bokeh Discourse
Hi, For certain bokeh layouts, I observe that the hover tool of one ... on GitHub: interaction between tooltips and gridplots · Issue...
Read more >
Adding Hover Actions - Real Python
Interactive Data Visualization in Python With Bokeh ... this you'll employ Bokeh's HoverTool() to show a tooltip when the cursor crosses paths with...
Read more >
Bokeh Tutorial — Adding Interactions - | notebook.community
from bokeh.plotting import figure from bokeh.io import gridplot x ... It is possible to link various interactions between different Bokeh plots.
Read more >
Interactive Data Visualization with Bokeh - Trenton McKinney
Basic plotting with bokeh.plotting; Layouts, interactions, ... HoverTool() function to create a HoverTool called hover with tooltips=None and mode='vline' .
Read more >
Formatting the HoverTool | Python - DataCamp
Format the field_goal_perc element of TOOLTIPS to display to the nearest two decimal places. Create the figure, labeling the x-axis as "Minutes" and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found