Description Usage Arguments See Also Examples
Places a set of arrows in a rgl device
1 2 3 4 5 | radial_arrows_3d(x, y, z, variable_names = names(x), center_pos = c(0, 0,
0), color = "darkorange", head_shape_theta = pi/6, head_shape_n = 3,
head_size = 0.1, body_length = 1, body_width = 1,
label_color = "black", label_cex = 1, label_family = "serif",
label_font = 2, label_adj = 0, label_alpha = 1)
|
x, y, z |
Numeric vectors representing point coordinates where arrows are pointing to. |
variable_names |
Character vector with the names of the variables to be plotted as arrow labels. |
center_pos |
Numeric vector of length three containing the 3D position from which arrows are drawn. |
color |
The color or colors to be used in arrows. |
head_shape_theta |
Numeric, the angle of the barb of the arrows
head ('theta' in |
head_shape_n |
Numeric, the number of barbs in the arrows head
('n' in |
head_size |
Numeric, the size of the arrows head ('s' in
|
body_length |
Numeric, the length of the arrows body, as a fraction of the true distance from the origin. |
body_width |
Numeric, the width of the arrows body ('lwd' in
|
label_color |
The color or colors of arrows' labels. |
label_cex, label_family, label_font, label_adj, label_alpha |
The text parameters and the alpha of the arrows' labels
( |
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 | ## Not run:
# Use iris data
data("iris")
# Principal Components Analysis
pca <- princomp(iris[, 1:4])
# Initializes the rgl device
rgl_init(theta = 330)
# add axes and bounding box
rgl_format(x = pca$scores[, 1], y = pca$scores[, 2], z = pca$scores[, 3],
axis_titles = c("PCA-1", "PCA-2", "PCA-3"))
# Add data points
points3d(x = pca$scores[iris$Species=="setosa", 1],
y = pca$scores[iris$Species=="setosa",2],
z = pca$scores[iris$Species=="setosa", 3],
color = "green")
points3d(x = pca$scores[iris$Species=="versicolor", 1],
y = pca$scores[iris$Species=="versicolor",2],
z = pca$scores[iris$Species=="versicolor", 3],
color = "red")
points3d(x = pca$scores[iris$Species=="virginica", 1],
y = pca$scores[iris$Species=="virginica",2],
z = pca$scores[iris$Species=="virginica", 3],
color = "blue")
# Add covariance arrows
radial_arrows_3d(x = pca$loadings[,1],
y = pca$loadings[,2],
z = pca$loadings[,3],
body_width = 5)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.