PCA analysis plot

This post was flagged by the community and is temporarily hidden.

Hi, welcome!,

If you mean how to format the numbers as percentage values in the axes, then you can add this lines to your plot.

    scale_x_continuous(labels = scales::percent_format(accuracy = 0.1)) +
    scale_y_continuous(labels = scales::percent_format(accuracy = 0.1))

If you need more specific help, please provide a minimal REPRoducible EXample (reprex). A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

I'm not able to completley reproduce your code with the sample data you are providing, also your question is about plotting with ggplot2 and you are not narrowing down your code to just the problematic part.
If I add the two lines I gave you before, I get this plot, is this what you want?

ggplot(data3, (aes(comp1, comp2))) +
  geom_point(aes(colour=raw.data[[group]]), size=samplePointSize, alpha=samplePointAlpha) +
  stat_ellipse(aes(group=raw.data[[group]],colour=raw.data[[group]]), level=certainty) +
  scale_colour_discrete(name = legendTitle) +
  scale_shape_discrete(name = legendTitle) +
  xlab(xlabel) +
  ylab(ylabel) +
  theme_bw(base_size = legendTextSize, base_family = "") +
  theme(legend.direction = legendDirection, legend.position = legendPosition) +
  scale_x_continuous(labels = scales::percent_format(accuracy = 0.1)) +
  scale_y_continuous(labels = scales::percent_format(accuracy = 0.1))

If you want to do it manually you just have to change this two variables in your script

xlabel =  "PLS1 (5.8%)"
ylabel = "PLS2 (67.9%)"

If you want this to happen automatically then I'm afraid I don't understand what those numbers represent so I have no idea how to calculate them, so I would insist in asking you a minimal reproducible example for your issue.