How do i plot vertical line over a timeseries curve in plotly

Hi,
I have two traces as below trace1 and trace2. I want to make a vertical line at a particular x value which is in events_i[0].
How do i plot a vertical line at a particular x point, possibly multiple X points which will be from an array which span the entire plot vertically.
I tried using shapes but it is not working.

trace1 = go.Scatter(
x = df123.index,
y = df123[โ€˜1_RSRP0โ€™],
name = โ€˜1_RSRP0โ€™,
xaxis=โ€˜x1โ€™,
mode =โ€˜markersโ€™
)

trace2 = go.Scatter(
x = df123.index,
y = df123[โ€˜2_RSRP0โ€™],
name = โ€˜2_RSRP0โ€™,
xaxis=โ€˜x1โ€™,
mode =โ€˜markersโ€™
)

data = [trace0,trace1,trace2]

layout = Layout(
title=โ€œRSRP v timeโ€,
yaxis=YAxis(
title = โ€œdbโ€
),
xaxis=XAxis(
title= โ€˜timeโ€™
)

)

fig = Figure(data=data,layout=layout)

iplot(fig)

I am able to plot it using cufflinks with below command, however i wish to do it with plotly , as I have many more customizations to add on plot which are not available in cufflinks yet.

df123.iplot(x = โ€˜timeโ€™ , y = [โ€˜P_RSRP0โ€™ , โ€˜1_RSRP0โ€™,โ€˜2_RSRP0โ€™ ] , mode =โ€˜lines+markersโ€™,vline = events_i[0])

Can someone please help ?

-Thx
Jay

@joshijay655,
If you set in layout['yaxis'] the range=[c, d], then a vertical line through a point of coordinates (a,b) is defined as a scatter plot with mode='lines' and

  x=[a, a],
  y=[c ,d]

Any way to do this over subplotss ? Like line spanning all subplots ?

@joshijay655 You make lines that span subplots with shapes: https://plot.ly/python/shapes/

Hi Jack,

If I make lines with shapes, they do span the subplots , however is there any way to add hover text over those lines ?

-Thanks
Jay

Is there any way to add hover text over those lines ?

Not really. You could add transparent (opacity=0) scatter points behind the line in each subplot. This is the only way Iโ€™ve seen people add hover text to shapes.

Thanks need to try this, pretty inconvenient though