Speed up loading and rendering exported html of 3D scatter plots
I use the plotly python api (Scatter3d) method to create 3D scatter plots. I love how plotly will export the generated graph into html and saves a temp file. I use the api in the offline mode.
The problem I have is when loading the saved html file (which is around 2-3 Mb with 100-200 points), after chrome renders the graph axis, the whole image freezes for a few seconds.
This is only noticed in certain computers.
- I dont mind waiting for the loading but I would like the graph to be completely loaded once the axis appears. My client does not like the ‘freezing’ effect when he tries to move the 3d plot. just using the python api, how can i make the exported html as lean and optimized as much as possible?
- Changing the browser didn’t help. Are there any other workarounds when viewing the scatter plots?
- Is there anything we can do to optimize the graphs and reduce the freezing observed at the start?
code snippets used to generate the plot
import plotly.graph_objs as go def __get_trace(x, y, z, color='rgba(255, 182, 193, .9)', size=3, opacity=0.8): trace = go.Scatter3d( x=x, y=y, z=z, hoverinfo='skip', mode='markers', marker=dict( size=size, line=dict( color=color, # set color equal to a variable width=0.5 ), opacity=opacity ) ) return trace def __plot_scatter(x, y, z, color='rgba(255, 182, 193, .9)', size=3, opacity=0.8): trace = __get_trace(x, y, z, color, size, opacity) data = [trace] layout = go.Layout( margin=dict( l=0, r=0, b=0, t=0 ) ) fig = go.Figure(data=data, layout=layout) plotly.offline.plot(fig) return