Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Which is faster to redraw plotly react or plotly?


Asked by Riggs Hogan on Dec 09, 2021 React



Because there are no indices to deal with, arrays need not be wrapped. Also, no argument specifying applicable trace indices is passed in. This function has comparable performance to Plotly.react and is faster than redrawing the whole plot with Plotly.newPlot.
Accordingly,
Plotly.react has the same signature as Plotly.newPlot above, and can be used in its place to create a plot, but when called again on the same <div> will update it far more efficiently than Plotly.newPlot, which would destroy and recreate the plot. Plotly.react is as fast as Plotly.restyle / Plotly.relayout documented below.
One may also ask, Under the hood, react-native-plotly is just a webview that has plotly.js injected into it. The plotly.js code is stored on the device, so it will work offline. react-native-plotly also provides methods for calling into the webview with updates to the chart data and layout.
Just so,
An efficient means of changing attributes in the data array in an existing plot. When restyling, you may choose to have the specified changes affect as many traces as desired. The update is given as a single object and the traces that are affected are given as a list of traces indices.
Similarly,
Letting plotly autorange means it needs to do relayouts often and requires it to calculate the range each time. Specifying the range can speed it up. Doing that here takes the frame rate up to ~24 fps. ( code) Drawing the legends is surprisingly expensive.