custom color in PCA analysis
Issue #766
new
I have run a PCA analysis per the tutorial on a trajectory and, separately, have scored each step using Rosetta. I would like to color each data point within the PCA plot using a color gradient that corresponds to the Rosetta score (eg blue to red). The rosetta score is loaded as a data frame. Is this feasible to do and can you please provide some guidance on how to do this?
The PCA plot is basically a scatter plot and in R you can color each point differently in a scatter plot. You can use the
colorRamp()
function from the grDevices package to create a color gradient and then map your (normalized) data to the color. For example,
Another option is to use the ggplot2 package, which allows a direct map of continuous values to a color bar. You can easily find many documents online for how to use it.
Hope it may help.