plotly / plotly/plotly.py

Show only exact x matches in hover with hovermode="x unified"

Open
#4,717 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

Currently, if there are two traces a, b with hovermode="x unified", then a value from trace b can be shown in the hoverinfo even when I am hovering on a x coordinate where there is no point in trace b, but only in trace a, see picture, where hovering over point from trace a with x=3 shows point from trace b with x=3.05.
I would like a way to enforce that only points with exactly matching x coordinates are shown in the hover (something like hovermode="x unified exact"?).

image

Code to generate figure from the screenshot:

fig = go.Figure(
    layout=go.Layout(hovermode="x unified"),
    data=[
        go.Scatter(
            x=[1, 3],
            y=[1, 1],
            name="a",
        ),
        go.Scatter(
            x=[1, 3.05],
            y=[2, 2],
            name="b",
        ),
    ],
)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided go.Figure reproduction and its layout hovermode="x unified" setting, then trace the hover matching behavior used by the graphing implementation. Done means a supported option or mode shows only traces with exactly matching x coordinates, while preserving the existing unified hover behavior for other cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.