Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimize Plotly Parallel plot

I am doing a parallel plot with plotly. It works, but get very time consuming when I apply it to huge data, because I am doing as many "trace" as markers.

How can I do it faster?

There is a reproducible example showing how I do it yet :

#Create data
markers=paste("markers",letters,sep="_")
data=data.frame(
    mark=rep(markers,3),
    map=c(rep(1,26) , rep(2,26) , rep(3,26)),
    pos=sample(seq(1:100) , 26*3)
    )

# Make the plot with Plotly
library(plotly)
plot_ly(data , x=map , y=pos, mode="markers+lines"  , group=mark)

And that is the result

My current plotly parallel plot

Thank you so much for your help !

like image 876
yholtz Avatar asked Aug 12 '26 02:08

yholtz


2 Answers

For each trace, plotly.js must calculate default plot and layout data, so the initial plot will not be very fast. For large data sets, you should use the scattergl plot type instead of scatter, but ideally, you should re-arrange your data so that you don't need to plot as many traces (if this is possible).

like image 153
Miklós Tusz Avatar answered Aug 13 '26 17:08

Miklós Tusz


Now there's a native parallel coordinates trace parcoords in plotly.js which was built for scalable operations, e.g. uses the GPU for crossfiltering and rendering. Some of the styling is therefore more constrained than with regular lines. Besides the brush filtering, it also has axis drag and drop by grabbing the axis title.

Doc: https://plot.ly/javascript/reference/#parcoords

Examples:

  • https://plot.ly/javascript/parallel-coordinates-plot/
  • https://codepen.io/monfera/pen/dNBwOv

As usual, the functionality is accessible via the Python, R etc. API bindings too, e.g. https://plot.ly/python/parallel-coordinates-plot/

It's an older question, just adding this answer for future search hits on this page.

like image 25
Robert Monfera Avatar answered Aug 13 '26 16:08

Robert Monfera



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!