I am hoping to use plotly.graph_objects.Mesh3d
, with the alphahull
parameter set to an appropriate value, to build a 3D alpha hull around a pretty large set of points. However, I am surprised to find that the load time for the output (whether written to HTML or using figure.show()
) is very long, even when the output file size is small (only a few MB) and the code run time is a fraction of a second.
Here is an example script. Approximate load times for each value of num
for me are: 5 seconds for num=1000
, 15 seconds for num=3000
, 24 seconds for num=5000
, 52 seconds for num=10000
. These each run in a fraction of a second. The num=10000
HTMl file is about 4 MB, which is smaller than other types of Plotly-generated 3D plots I’ve made that open much faster.
from numpy.random import random as rand
import plotly.graph_objects as go
# num = 1000
# num = 3000
# num = 5000
num = 10000
x = rand(num)
y = rand(num)
z = rand(num)
fig = go.Figure(data=[go.Mesh3d(x=x, y=y, z=z,
alphahull=5,
opacity=0.4,
color='cyan')])
fig.write_html("temp.html")
Is there anything I can do to significantly decrease opening time for these plots? I need to scale these plots to much larger numbers of points than the 10,000 I have here, and 52 seconds to open is already too long.