# Simulated data on (S^1)^2
n <- 50
samp <- r_path_s1r(n = n, r = 2, k = c(1, 2), angles = TRUE)
plot(samp, xlim = c(-pi, pi), ylim = c(-pi, pi), col = rainbow(n),
axes = FALSE, xlab = "", ylab = "", pch = 16, cex = 0.75)
points(torus_to_angles(r_kde_polysph(n = 10 * n, X = angles_to_torus(samp),
d = c(1, 1), h = c(0.1, 0.1))),
col = "black", pch = 16, cex = 0.2)
sdetorus::torusAxis()
# Simulated data on S^2
n <- 50
samp <- r_path_s2r(n = n, r = 1, sigma = 0.1, kappa = 5,
spiral = TRUE)[, , 1]
sc3d <- scatterplot3d::scatterplot3d(
samp, xlim = c(-1, 1), ylim = c(-1, 1), zlim = c(-1, 1),
xlab = "", ylab = "", zlab = "", color = rainbow(n), pch = 16
)
xyz <- r_kde_polysph(n = 10 * n, X = samp, d = 2, h = 0.1)
sc3d$points3d(xyz[, 1], xyz[, 2], xyz[, 3], col = "black", pch = 16,
cex = 0.2)
Run the code above in your browser using DataLab