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(-2log(u))sin(2piv)
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