# Displaying a 3D scatter with a lot of data crashes

**URL:** https://discourse.julialang.org/t/displaying-a-3d-scatter-with-a-lot-of-data-crashes/105352
**Category:** Visualization
**Tags:** plots
**Created:** [October 24, 2023, 3:40pm UTC](https://discourse.julialang.org/t/displaying-a-3d-scatter-with-a-lot-of-data-crashes/105352 "2023-10-24T15:40:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yuvalw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuvalw/32/19224_2.png) [@yuvalw](https://discourse.julialang.org/u/yuvalw)
#### Post date: [October 24, 2023, 3:40pm UTC](https://discourse.julialang.org/t/displaying-a-3d-scatter-with-a-lot-of-data-crashes/105352/1 "2023-10-24T15:40:19Z")

</div>

Hello,  
Is there an efficient way to do this? I’m having crashes with even 1000 data points. I noticed that using different colors for data points (i.e. `zcolor`) makes the figure 10x heavier upon saving.

I would like to be able to rotate the image, like it is in `plotly`, rather than a static scatter. I thought my computer would be able to display heavy plots:  
32 × 13th Gen Intel(R) Core™ i9-13900K  
128 GB RAM  
NVIDIA RTX A4500, 20 GB  
Can you say what would be a reasonable number of points to handle?  
Would Makie be better at this?

```julia
using Plots
plotly()
n = 500
scatter3d(eachcol(rand(n,3))..., zcolor=rand(n))

```

Thank you.

---

<div class="post-metadata">

### Author: ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)
#### Post date: [October 24, 2023, 4:37pm UTC](https://discourse.julialang.org/t/displaying-a-3d-scatter-with-a-lot-of-data-crashes/105352/2 "2023-10-24T16:37:33Z")

</div>

Did you try the plotlyjs() backend?

Also, many people use Makie.jl nowadays for interactive 3D visualization:

> **[Home · Makie](https://docs.makie.org/stable/)**
>
> Create impressive data visualizations with Makie, the plotting ecosystem for the Julia language. Build aesthetic plots with beautiful customizable themes, control every last detail of publication quality vector graphics, assemble complex layouts and...

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [October 24, 2023, 9:34pm UTC](https://discourse.julialang.org/t/displaying-a-3d-scatter-with-a-lot-of-data-crashes/105352/3 "2023-10-24T21:34:33Z")

</div>

It works OK in the MS Edge browser and with `n = 10_000` points in my small Win11 laptop:

```julia
Device name	XPS13-7390
Processor	Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz 1.50 GHz
Installed RAM	32.0 GB

```

However, it takes more than 30 s to render the plot, and until then we need to click `Wait` every time a window pops up saying `This page isn't responding`.

---

<div class="post-metadata">

### Author: ![yuvalw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuvalw/32/19224_2.png) [@yuvalw](https://discourse.julialang.org/u/yuvalw)
#### Post date: [October 29, 2023, 9:37am UTC](https://discourse.julialang.org/t/displaying-a-3d-scatter-with-a-lot-of-data-crashes/105352/4 "2023-10-29T09:37:36Z")

</div>

I could not make `plotlyjs` to work. I’m new to Makie, but I tried using WGLMakie, using the following code (Not sure if this is the best way to do it):

```julia
using JSServe
using WGLMakie

Page(exportable=true, offline=true)
n = 5000
x = rand(n)
y = rand(n)
z = rand(n)
c = rand(n)
f = Figure()
a = WGLMakie.scatter(x, y, z, color=c)
WGLMakie.save("test1.html", a.figure)

```

Overall, it seems that the HTML file does not scale with `n` in either size or time to render, unlike Plotly, which seems to scale linearly with `n`, so in that sense it’s great.  
The only thing I find missing is that in Plotly, by default I can click on labels in the legend to hide the corresponding series. Is it easily done in Makie as well?  
Thanks
