plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.95k stars 1.86k forks source link

Multiple Surface Plot traces result in plot crashing #4112

Closed 0x5e5e closed 5 years ago

0x5e5e commented 5 years ago

Codepen: https://codepen.io/0x5e5e/pen/qeoZNd

Hey plotly.js maintainers!

I'm drawing multiple curved surfaces as part of a general 3D cone shape - see codepen above.

The codepen is only drawing 50 of the surfaces (see line 2710, feel free to have it try to load all the surfaces), I have about 300 in this case and up to 2-3k in others (number of data sections) - but whenever I try to load more than a certain amount (on my machine is 150, seems like it depends on how much RAM one has available) the plot just crashes which I'm assuming means it went out of memory.

The surface data is generated in python to use numpy functions, then embedded in the javascript. I run into this same issue with the python plotly library as well.

My question is - is this normal/expected behavior based on the number of surface glyphs I have? Is there any way I can optimize this so it uses less memory per surface plot so I can draw more without it crashing? I'm fine without lighting if that helps at all. If this is just a limitation of plotly's rendering I would love to try to optimize this in the code if pointed in the right direction.

I know drawing multiple surfaces might not be ideal as it could just be one single surface but I could not find a way to finagle surfacecolor to get it to achieve the same effect I have here (for each "bin" or section of data, it has a color based on a color range that is not the Z value - I tried to use surfacecolor but it was just one giant blended together soup of colors that looked different depending on what angle you were looking at it, instead of nice discrete sections).

etpinard commented 5 years ago

Duplicate of https://community.plot.ly/t/multiple-surface-plots-crashing/26999