# Performance of ListPointPlot3D

From an experiment I got a huge 3d data set (~ 4*10^6 data points) which I display with ListPointPlot3D.

How can I improve the speed of showing the plot in the notebook or saving it with Export.

Here is my example code:

SeedRandom[1];

data = RandomReal[10, {4000000, 3}]; // AbsoluteTiming

{0.0923029, Null}

plot3d = ListPointPlot3D[data, PlotStyle -> PointSize -> Tiny, Boxed -> True,
Axes -> True, AxesLabel -> {"x", "y", "z"}, ViewProjection -> "Orthographic",
ViewPoint -> {2, -2.4, 2}, AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}},
ColorFunction -> Function[{x, y, z}, Hue[x]]]; // AbsoluteTiming

{56.4218, Null}

Export[FileNameJoin@{$UserBaseDirectory, "plot3d.bmp"}, plot3d, "BMP"]; // AbsoluteTiming {1255.23, Null} Export[FileNameJoin@{$UserBaseDirectory, "plot3d.png"}, plot3d, "PNG"]; // AbsoluteTiming

{2126.69, Null}

• do you really need all the points? If you do like ListPointPlot3D[RandomSample[data, 10000]] you will often get what you need and much faster. Oct 19, 2017 at 19:59
• @george2079: Yes I need to see all the points, at least the projection which the 3d plot gives. The whole point distribution can be very different from the view of a subset of only 10000 points.
– mrz
Oct 19, 2017 at 20:31

Graphics3D using Point with VertexColors is much faster for producing the graphics:

 data = RandomReal[10, {4000000, 3}]; // AbsoluteTiming

(g3d = Graphics3D[{PointSize[Tiny],
Point[data, VertexColors -> (Hue /@ Rescale[data[[All, 1]]])]},
Boxed -> True, Axes -> True, AxesLabel -> {"x", "y", "z"},
ViewPoint -> {2, -2.4, 2},
AxesEdge -> {{-1, -1}, {-1, -1}, {-1, -1}}]; ) // AbsoluteTiming // First


0.131143

 g3d


With a smaller dataset with 400,000 points ListPointPlot3D takes 7.025276 seconds.

Also, using the File >> Save Selection As route is much faster than using Export.

• This is impressing: why is Graphics so much faster then ListPointPlot3D?
– mrz
Oct 19, 2017 at 20:29
• @mrz, I guess it is because it avoids overhead that *Plot and *Chart routines have to incur before they eventually invoke Graphics.
– kglr
Oct 19, 2017 at 20:52
• For File >> Save Selection As it is necessary to display the graphics in the notebook, which takes time. When I only want to save the plot there is probably no other command than Export?
– mrz
Oct 20, 2017 at 6:03