I'm using the pca3d
package and it's really convenient. However, I'd like to draw a full box around my pca2d
scores plot, rather than just having an x-axis.
The following code:
library(pca3d)
set.seed(111)
mat <- matrix(rnorm(10000), ncol = 100)
gps <- rep(c("Group A", "Group B", "Group C", "Group D"), each=25)
pca <- prcomp(mat)
pca2d(pca, group = gps, legend="topright", bty="o")
I can't find anything in the documentation for the function and package, although this blogger has managed to do it here.
You can just use base (graphics-package
) R's box()
command, e.g. like so:
box(which = "plot", lty = "solid")