if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/graph3d")
require(rgl)
#> Loading required package: rgl
data(iris)
x <- iris$Sepal.Length
y <- iris$Petal.Length
z <- iris$Sepal.Width
rgl_scatter(iris, groups = iris$Species, add.ellipse = TRUE,
data.scale = TRUE)
Remove the bounding box:
rgl_scatter(iris, groups = iris$Species, show.bbox = FALSE)
Add regression planes
rgl_scatter(iris, groups = iris$Species, show.bbox = FALSE, add.reg.planes = TRUE)
rgl_init()
rgl.spheres(x, y, z, r = 0.2, color = get_colors(iris$Species))
rgl_add_axes(x, y, z, show.bbox = TRUE)
rgl_add_ellipses(x, y, z, groups = iris$Species)
aspect3d(1,1,1)
The function s3d_addgrids() can be used as follow:
library("scatterplot3d")
data(iris)
# Basic 3d graphics
scatterplot3d(iris[,1:3])
# Remove box and add grids
scatterplot3d(iris[, 1:3], pch = 16, grid = TRUE, box = FALSE)
s3d_addgrids(iris[, 1:3], grid = c("xy", "xz", "yz"))
# quakes dataset
data("quakes")
dist3d(quakes$long, quakes$lat, colvar=quakes$depth,
breaks = 30, col.bar = "steelblue")
# Iris dataset
dist3d(iris$Sepal.Length, iris$Petal.Width, col.bar = "steelblue",
colvar=as.numeric(iris$Species))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.