plotly.py
plotly.py copied to clipboard
Show only exact x matches in hover with hovermode="x unified"
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"?).
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",
),
],
)