Add vline to subplot in python

I’m trying to add a vline to a subplot (in position row 2, col 1), it works fine without subplots, but with the subplot it fails. FWIW subplot 1,1 is table. Any advice? Relevant snippets of code:

# Prepare table subplot
        fig = make_subplots(
            rows=2, cols=1, row_heights=[0.2,0.8],
            specs=[[{"type": "table"}],
                   [{"type": "scatter"}]]

if table_cols_exist:
        # Create table and chart
        for index, trace in enumerate(data):
            if index==0:
                fig.append_trace(trace, row=1, col=1)
                fig.append_trace(trace, row=2, col=1)
        # Create chart only
        fig = go.Figure(data=data, layout=layout)

for changepoint in signif_changepoints:
            fig.add_vline(x=changepoint, line_width=0.8, line_dash="dot", line_color="darkslateblue", row=2, col=1)

which returns the following error

PlotlyKeyError: Invalid property specified for object of type plotly.graph_objs.Table: 'xaxis'

I came across this same issue today, and was able to resolve this error by calling the add_vline before adding the tables. Once the tables are added to the figure, the function no longer works. Hope this helps anyone else who runs across the issue!

The PlotlyKeyError shown above is for adding vline to a subplot with a table.

Looks like plotly does not support adding vline or hline to tables, only to graphs. Kind of make sense.

I don’t see this in plotly’s documentation, might be a good point to add.