I would like to change the number of decimals for the Proportion of Variance
displayed in the axes of a PCA plot using prcomp()
and autoplot()
. By default it's set to 2 decimals places (92.46%, 5.31%) but I'd like to round them to 1 decimal place (92.5%, 5.3%).
library(ggfortify) df <- iris[1:4] pca <- prcomp(df) autoplot(pca)
Thank you!
First, disable the default variance percentage displayed by using:
Then add the labels you want using: