Speed of extendTraces

I’m using extendTraces for live, incremental graphing, in which the application continually adds new data to a graph, in synchrony with an animation. I did a timing test and found that extendTraces is no faster than resetting the entire data set.

My impression is that all of the popular JS graphing libraries are aimed at situations where all of the data points are pushed into an array and then given to the graphing library, and that none of them have been concerned with optimizing the case of live, incremental additions to the displayed data. Or have I missed something important? Does Plotly have a mechanism for making efficient live plots?

An earler post of a similar kind didn’t get a response: See “Updating graph with new data every 100 ms or so”.

Bruce

You’re correct, our current implementation our extendTraces is pretty dumb and not much faster than newPlot.

We’re hoping to improve it in the next few months. Sorry for the inconvenience.

That is extremely good news. Thanks!

At the risk of stating what everyone knows: In my work on VPython over the years I’ve done three things to speed up incremental plotting.

First, when autoscaling, whenever a new point requires changing the scale, change the scale by a few percent more than needed to include the new point, so that there’s a good chance that a few later points can fit without readjusting the scale.

Second, for a lines object with no markers, discard any point that would be placed within a few pixels of the most recently plotted point. I’m doing this with my use of Plotly, and it can make a huge difference. Even without major improvements for incremental plotting, it would be useful for there to be a parameter to tell Plotly to discard points instead of me having to do the discarding; after all, Plotly knows more than I do about the pixel positioning. (The reason not to do this if there are markers is that in general markers on lines are important indications of endpoints of line segments.)

Third, provide an “interval=N” option for all types of objects, in which Plotly only adds to the plot the Nth point, discarding the rest.

Bruce