Description Usage Arguments See Also Examples
View source: R/rgl_group_representation.R
Compute and draw a labeled ellipsoid for each group in a rgl device. Singleton or groups with less than four observations are drawn as individual spheres.
1 2 3 4 5 6 7 | ellipsoids_3d(x, y, z, groups, group_color = rainbow(nlevels((groups))),
type = "wire and shade", level = 0.95, singleton_color = NULL,
singleton_radius = 0.1, wire_color = NULL, wire_alpha = 0.2,
wire_lit = FALSE, shade_color = NULL, shade_alpha = 0.1,
shade_lit = FALSE, label_color = NULL, label_cex = 1,
label_family = "sans", label_font = 2, label_adj = c(-0.25, 0.5),
label_alpha = 1)
|
x, y, z |
Numeric vectors representing point coordinates. |
groups |
A factor vector of length |
group_color |
A vector of length |
type |
a character representing the type of ellipsoid filling: "wire",
"shade" or "wire and shade" ( |
level |
the confidence level of a simultaneous confidence region
( |
singleton_color, wire_color, shade_color, label_color |
The
specific colors to be used in each ellipsoid's elements for each group.
If not NULL, they override the |
singleton_radius |
the radius of the spheres
( |
wire_alpha, wire_lit |
the wire alpha and lit parameters
( |
shade_alpha, shade_lit |
the shade alpha and lit parameters
( |
label_cex, label_family, label_font, label_adj, label_alpha |
the group
labels text parameters ( |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ## Not run:
# Use iris data
data("iris")
# introduce fictional singleton species
modIris <- iris
modIris$Species <- as.character(modIris$Species)
modIris <- rbind(modIris, list(6, 1, 2, 3, "outlier"))
modIris$Species <- factor(modIris$Species)
# Initializes the rgl device
rgl_init(theta = 60, phi = 45)
# add axes and bounding box
rgl_format(modIris$Sepal.Length, modIris$Sepal.Width, modIris$Petal.Length,
axes_titles = c("Sepal length", "Sepal width", "Petal length"),
show_planes = c("XZ", "XY", "YZ"))
# Add data points
points3d(modIris[modIris$Species == "setosa", 1],
modIris[modIris$Species == "setosa", 2],
modIris[modIris$Species == "setosa", 3],
color = "green")
points3d(modIris[modIris$Species == "versicolor", 1],
modIris[modIris$Species == "versicolor", 2],
modIris[modIris$Species == "versicolor", 3],
color = "red")
points3d(modIris[modIris$Species == "virginica", 1],
modIris[modIris$Species == "virginica", 2],
modIris[modIris$Species == "virginica", 3],
color = "blue")
# Add ellipsoids
ellipsoids_3d(modIris[, 1], modIris[, 2], modIris[, 3],
groups = modIris$Species,
group_color = c("purple", "green", "red", "blue"))
remove(modIris)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.