Hi, everyone - I'm having an issue with defining the color of each group on PCA plots.
Using the plot() function after performing PCA, my group colors are selected from the default R palette. When I re-plot the colors of each group using custom defined colors, however, not all of the points in each group are consistently converted into the new group color. In my specific case, the points that were black in the first PC plot are not all converted to yellow in the second PC plot, and the points that were pink in the first PC plot are not all converted to green in the second PC plot. Some of the points that were black or pink were, respectively, converted into green or yellow points. I'm not sure why this is the case. Why aren't the group colors staying consistent after choosing what colors I want to use? Is there a way to define colors/a color palette that won't do this?
I've attached the relevant files needed to see my problem - your help is greatly appreciated!
Best,
Claudia