plotly / plotly/plotly.py

Hoversubplots=axis not working with make_subplots

Open
#4,603 19 comments 22 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Initially reported on the Plotly forum.

Using make_subplots means that the hoversubplots=“axis” will not work correctly.

Sample code that produces the error:
Codepen.

import plotly.graph_objects as go
from plotly import data
from plotly.subplots import make_subplots

df = data.stocks()


fig = make_subplots(rows=3, cols=1, shared_xaxes=True, vertical_spacing=0.03)
layout = dict(
    hoversubplots="axis",
    title="Stock Price Changes",
    hovermode="x",
    grid=dict(rows=3, columns=1),
)

fig.add_trace(go.Scatter(x=df["date"], y=df["AAPL"], name="Apple"), row=1, col=1)
fig.add_trace(go.Scatter(x=df["date"], y=df["GOOG"], name="Google"), row=2, col=1)
fig.add_trace(go.Scatter(x=df["date"], y=df["AMZN"], name="Amazon"), row=3, col=1)
fig.update_layout(layout)
fig.show()

bdc0bda148a0bc897f35bde5ac36eda09b53f731_2_1035x496

Expected behavior should be the same as when using the Plotly docs hover on subplots example, where hover labels appear for all charts:
Codepen.
image

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 by reproducing the provided Python example with make_subplots and the hoversubplots="axis" layout, then compare it with the linked Plotly documentation example. Trace how subplot axes and hover settings are generated; done means hover labels appear for all charts as shown in the expected example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.