Skip to content

enable multiple hover boxes for overlapping/multiple points #2476

Open
@johann-petrak

Description

@johann-petrak

This has been tested in version 4.7.1.

When hover information is shown for points e.g. in a scatter plot, the following situations can occur:

  • there are multiple points on exactly the same coordinates
  • there are multiple points close to the same coordinates and the markers used to visualize those points overlap in the graph

Hover information for all those multiple points should be shown, especially in cases where the hover information includes additional data not shown directly in the graph.

The hvPlot library does this correctly: it shows stacked hover boxes for all the data points under the cursor. Plotly only shows one hover box and it is not clear which one.

I think this is an actual bug since it makes it easy to miss data and the hover information does not represent the actual data in the graph.

Here is an example using the Iris data set and Plotly:

import plotly.express as px
from bokeh.sampledata import iris
df = iris.flowers.copy()
fig = px.scatter(df, x="sepal_length", y="sepal_width", color="species",
                 opacity=0.4, hover_data=["petal_length", "petal_width"]
                )
fig.show()

This shows:
plotly01

With hvPlot:

df.hvplot(kind="scatter", 
          x="sepal_length", y="sepal_width", by="species", 
          hover_cols=["petal_length", "petal_width"], 
          alpha=0.4)

Hvplot01

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions