0
votes

Plotting a fairly large point cloud in python using plotly produces a graph with axes (not representative of the data range) and no data points.

The code:

import pandas as pd
import plotly.express as px
import numpy as np


all_res = np.load('fullshelf4_11_2019.npy' )

all_res.shape

(3, 6742382)

np.max(all_res[2])

697.5553566696478

np.min(all_res[2])

-676.311654692491

frm = pd.DataFrame(data=np.transpose(all_res[0:, 0:]),columns=["X", "Y", "Z"])
fig = px.scatter_3d(frm, x='X', y='Y', z='Z')
fig.update_traces(marker=dict(size=4))
fig.update_layout(margin=dict(l=0, r=0, b=0, t=0))
fig.show()

blank plot produced by plotly

Alternatively you could generate random data and follow the process through

all_res = np.random.rand(3, 6742382)

Which also produces a blank graph with a axis scales that are incorrect.

So -- what am I doing wrong, and is there a better way to plot such a moderately large data set?

Thanks for your help!

2
have you tried matplotlib ? - Zaraki Kenpachi
The approach that works is to use open3d. - userX

2 Answers

0
votes

It seems like that's too much data for WebGL to handle. I managed to plot 100k points, but 1M points already caused Jupyter to crash. However, a 3D scatterplot of 6.7 million points is of questionable value anyway. You probably won't be able to make any sense out of it (except for data boundaries maybe) and it will be super slow to rotate etc.

I would try to think of alternative approaches, depending on what you want to do. Maybe pick a representative subset of points and plot those.

0
votes

Try plotting using ipyvolume.It can handle large point cloud datasets.