# NOT RUN {
# generate four variants of 3D data
SC <- Gen.dr.data("scurve")
SR <- Gen.dr.data("swissroll")
HX <- Gen.dr.data("helix")
SS <- Gen.dr.data("ssphere")
# plot them (requires packages 'scatterplot3d' and 'rgl')
if (requireNamespace("rgl", quietly = TRUE)) {
COL <- colorRampPalette(c("green", "orange"))(1000)
scatterplot3d::scatterplot3d(SC, color=COL, pch=20, cex.symbols=1.4)
} else {
cat("Please install 'rgl' package to see the plot")
}
if (requireNamespace("rgl", quietly = TRUE)) {
rgl::plot3d(SR, col=rainbow(1100))
} else {
cat("Please install 'rgl' package to see the plot")
}
if (requireNamespace("rgl", quietly = TRUE)) {
rgl::plot3d(HX, col=rainbow(1100))
} else {
cat("Please install 'rgl' package to see the plot")
}
if (requireNamespace("rgl", quietly = TRUE)) {
rgl::plot3d(SS, col=rainbow(1100))
} else {
cat("Please install 'rgl' package to see the plot")
}
# }
Run the code above in your browser using DataLab