Black Lives Matter. Please consider donating to Black Girls Code today.

Scattergeo performance: lines vs markers

Hi all,

New to the forum. I’ve been playing around with plotly and dash for the last few days.

I have made a dashboard including a go.Scattergeo objects on a world map. I have about 20k points, which I can filter with some slicers.
I noticed that when I used go.Scattergeo() with the mode=‘markers’ option, the plot rendered very quickly. However, using mode=‘lines’ slows the plotting process enormously.

I have the feeling this has to do with the fact that for plotting points, vectorization is used. Indeed, when using the ‘lines’ option, I (as far as I can see from the examples and web) require a for loop over all line segments.

Is there any way to speed up plotting many lines with Scattergeo?

My own attempts:

I considered manually cashing a list of Scattergeo() objects and use my filters to quickly select them, but this takes too much time and memory to initialize my app.

I also looked into caching, but this seems rather complicated as I have four arguments in the @app.callback procedure. I would like, at a later stage, to publish this app at Herokuapp. I’d rather avoid complicated caching procedures that might not work at Heroku.

There is no scattergeogl (like scattergl), so that was not an option either.

Any recommendations are helpful!