3d graphs of large data sets don't render in Jupyter

I’m trying to create 3d graphs of large data sets(~10 million data points), but for some reason the graph won’t render in plotly, so I was wondering if anyone knew why and/or how to fix it.

To generate some sample data, I use:

import numpy as np
COUNT = 1_000_000
z = np.arange(COUNT)
x = np.cos(z/1000)
y = np.sin(z/1000)

To render in plotly I run

import plotly
import plotly.graph_objs as go
plotly.offline.init_notebook_mode()
import plotly.io as pio
pio.renderers.default = 'iframe'
trace = go.Scatter3d(
    x=x,
    y=y,
    z=z, 
    mode='markers',
    marker={
        'size': 10,
        'opacity': 0.7,
    }
)

layout = go.Layout(
    margin={'l': 0, 'r': 0, 'b': 0, 't': 0}
)

data = [trace]

plot_figure = go.Figure(data=data, layout=layout)

# Render the plot.
plotly.offline.iplot(plot_figure)

which gets me a beautifully rendered, empty cube.

If I instead use matplotlib:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(projection='3d')
ax.scatter(x,y,z)
plt.show()

It renders fine, if a little ugly:

with COUNT = 100_000, both render fine, showing that the problem is the amount of data.[!

I previously posted this to stack overflow, to no avail.

This is a massive amount of data points. Keep in mind, that plotly renders in the browser to make it interactive whereas matplotlib generates a static image.

Based on my personal experience I would soy, you can’t render this many datapoints with plotly. For a 2d scatter there was an option of using scatterGL (or similar) which improved the behavior for larger datasets, but I think this option does not exist for scatter3D

It seems to me it should at least throw an error, rather than it just pretending to work - as it is, I get an interactive 3d graph with axis, it’s just blank.

yes, you are right.