Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hoversubplots=axis not working with make_subplots #4603

Open
Coding-with-Adam opened this issue May 6, 2024 · 0 comments
Open

Hoversubplots=axis not working with make_subplots #4603

Coding-with-Adam opened this issue May 6, 2024 · 0 comments

Comments

@Coding-with-Adam
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant