1

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. 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. axis on 3d graph, no data

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: matplotlib

with COUNT = 100_000, both render fine, showing that the problem is the amount of data.matplotlib and plotly rendering as normal

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.