Faster fig.add_vline?

Does anyone know a way to add vlines quickly to a figure. The fig.add_vline method becomes slower with each iteration. At around 250 vlines it can take up to 5 minutes to generate. Long term I am targeting an interactive update of the vlines via callback 5 minutes is a long time to wait.


what are you using to iterate? A simple for loop is the slowest method, try to iterate using a list comprehension

Having the same issue. Did you find a quicker solution?

Maybe you could just create annotations in a loop and once finished, add the annotations to the figure.

I am not too familiar with the Plotly Jargon but if I got it right, you mean to create a single trace for the vertical lines that need to be added, and then incorporate it into your main figure. Is this what you meant?
This could be more efficient. Let me try !

Exactly, that’s what I meant.