I am trying to create a biplot but my labels are chemical formulas that need subscript for example: NO3 should be NO subscript 3 superscript -. How can I get the subscript in the labels for the column names on a biplot?
library("FactoMineR")
library("ggplot2")
Site <- c("site1", "site2", "site3")
NO3 <- c(100, 300, 200)
NH4 <- c(210, 400, 800)
DON <- c(300, 350, 200)
dat <- cbind(NO3, NH4, DON)
data.frame(dat)
rownames(dat)<- Site
res.pca <- PCA(dat, scale.unit = TRUE, ncp = 4, graph = TRUE)
print(res.pca)
PCA
returns a ggplot object, so you can just add more layers:plot.PCA(res.pca, choix = 'var', label = 'none') + geom_text(aes(label = c('NO[3]', 'NH[4]', 'DON')), parse = TRUE)
– rawr