You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to modify PCA variable names in ggbiplot such that there can be Greek characters and sub-superscripts. I have included the data and here is what I have worked through so far. rename_pca_var.csv
library(ggplot)
library(ggbiplot)
### Read in Data
data.example <- read.csv("rename_pca_var.csv")
head(data.example)
### removing categorical data. Running the PCA.
pca.example <- prcomp(data.example[,-c(1:6)],
center = TRUE,
scale. = TRUE)
I would like to be able to update the PCA variables from "Phi" to Greek letters and be able to alter some of the text to subscripts and superscripts. Normally this could be done using supplying a variable with expression(Phi ["PSII"]) which would produce the Greek symbol and subscript PSII.
This is able to solve the issue of Greek letters but not the issue of printing sub-superscripts. Is there a way to add a variable to the ggbiplot function that could update the names of the variables, including the standard expression functionality in a similar way one may update variables in a legend? ie
ggbiplot(pca.example.name_change,
varname.update = c(expression(Phi ["PSII"]),expression(Phi ["NO"]),expression(Phi ["NPQ"]), "SPAD", expression(vH^"+"), "qE", "qT", "qI")), ### This Would be the modification ###
obs.scale = 1,
var.scale = 1,
varname.size = 5,
labels.size=3,
groups = data.example$treatment,
ellipse = TRUE,
ellipse.alpha = 0.1,
circle = FALSE,
ellipse.prob = 0.68,
varname.adjust= 1.5,
inherit.aes = FALSE,
repel = TRUE,
scale = 0,
parse = TRUE)
I believe my current solution is sufficient for what I am doing but feel there may be other individuals who would appreciate the full functionality of expression() in ggbiplot.
The text was updated successfully, but these errors were encountered:
I would like to modify PCA variable names in ggbiplot such that there can be Greek characters and sub-superscripts. I have included the data and here is what I have worked through so far.
rename_pca_var.csv
I would like to be able to update the PCA variables from "Phi" to Greek letters and be able to alter some of the text to subscripts and superscripts. Normally this could be done using supplying a variable with
expression(Phi ["PSII"])
which would produce the Greek symbol and subscript PSII.This is able to solve the issue of Greek letters but not the issue of printing sub-superscripts. Is there a way to add a variable to the ggbiplot function that could update the names of the variables, including the standard expression functionality in a similar way one may update variables in a legend? ie
I believe my current solution is sufficient for what I am doing but feel there may be other individuals who would appreciate the full functionality of
expression()
in ggbiplot.The text was updated successfully, but these errors were encountered: