Tick labels broken when unifying hover across subplots

Hi! I was reading and hopping between threads and I guess this could work for what I see. It’s up to you figure out how to reduce the gap between subplots…
The answer, anyway, is in this thread, that I’ve supposed you have read already…
Hover question. how to info in all trace Thanks to @empet :bulb:

Code with grid instead make_subplots
import plotly.graph_objects as go
import pandas as pd
from plotly import data

df = data.stocks()

fig=go.Figure([
    go.Scatter(x=df["date"], y=df["AAPL"], xaxis="x", yaxis="y", name="Apple"),
    go.Scatter(x=df["date"], y=df["GOOG"], xaxis="x", yaxis="y2", name="Google"),
])
fig.update_layout(height=550, #width=750,
                  showlegend=False,
                  hoversubplots="axis",
                  title="Stock Price Changes",
                  hovermode="x unified", #or "x unified" without dashed line
                  grid = dict(rows=2, columns=1, #the grid cells (row, col): [[(0,0), (0,1)], [(1,0), (1,1)]
                              subplots=[["xy"],#, ""],  #this grid attribute gives info on the position of each trace
                                        ["xy2"]],#, ""]],
                              xgap=0)
                 )
fig
1 Like