Reputation: 11
So I just want to be able to clearly see the points, and get rid of the vectors, because I am not interpreting those, here is my code:
FrogPCA <- prcomp(FrogData[,3:12], center=TRUE, scale=TRUE)
summary(FrogPCA)
biplot(FrogPCA, choices = c(1,2), col = c("magenta3", "slateblue3" ))
Any help is appreciated!
Upvotes: 0
Views: 1023
Reputation: 50668
Here is an example how to re-produce the biplot
output without the unscaled axes (i.e. the red arrows), based on the USAarrests
dataset (unfortunately you don't provide data).
pca <- prcomp(USArrests, scale = TRUE)
plot(pca$x[, "PC1"], pca$x[, "PC2"], type = "n", xlab = "PC1", ylab = "PC2")
text(pca$x[, "PC1"], pca$x[, "PC2"], rownames(pca$x))
Upvotes: 2
Reputation: 886
How about this (the example is with iris):
> data(iris)
> #iris
>
> IrisPCA <- prcomp(iris[, 1:3], center = TRUE, scale = TRUE)
> table(iris$Species)
setosa versicolor virginica
50 50 50
>
> plot(IrisPCA$x, col = c(rep("red", 50), rep("green", 50), rep("blue", 50)))
There is package called plot3D that can perform the same in 3 dimensions. If its usefull I can edit later.
Hope it helps.
Upvotes: 2