# Plot\_ly doesn't plot anything

**URL:** <https://community.plotly.com/t/plot-ly-doesnt-plot-anything/21999>\
**Category:** Plotly R\
**Created:** [April 8, 2019, 2:03am UTC](https://community.plotly.com/t/plot-ly-doesnt-plot-anything/21999 "2019-04-08T02:03:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sevaus](https://avatars.discourse-cdn.com/v4/letter/s/e56c9b/32.png) [@sevaus](https://community.plotly.com/u/sevaus)\
**Post date:** [April 8, 2019, 2:03am UTC](https://community.plotly.com/t/plot-ly-doesnt-plot-anything/21999/1 "2019-04-08T02:03:46Z")

</div>

Hello,

The following code does not produce a plot (even plots \> save as Image in RStudio doesn’t work):

```
library(plotly)

```

library(ggplot2)  
norme2 = function(x){

return(sqrt(sum(x^2)))

}

simuNormale = function(n) {

u = runif(n)  
v = runif(n)  
x = sqrt(-2_log(u))sin(2pi_v)

return(x)

}

simuSphere = function(d, n){

X = matrix(nrow = n, ncol = d)

for(i in 1:n){

```
N = simuNormale(d)

X[i,] = N/norme2(N)

```

}

return(X)  
}

Y = simuSphere(3, 10000)  
Y = as.data.frame(Y)  
names(Y) \<- c(“x”, “y”, “z”)  
plot\_ly(data = Y, x = ~x, y = ~y, z = ~z, type = “scatter3d”, mode = “markers”)

My specs are platform x86\_64-w64-mingw32  
arch x86\_64  
os mingw32  
system x86\_64, mingw32  
status  
major 3  
minor 5.2  
year 2018  
month 12  
day 20  
svn rev 75870  
language R  
version.string R version 3.5.2 (2018-12-20)  
nickname Eggshell Igloo
