Dear all,
I'm new to ballgown and one of the things I'd like to do is to create a PCA plot using R / ggplot2's ggfortify. I have something like this so far:
and this works nicely, but I'd like to colour the points by sample. For example, see https://cran.r-project.org/web/packa.../plot_pca.html
As the above web page describes, I can colour it by giving it a "colour = 'Species'" argument...this is a vector which lists the sample names (as a factor).
Does anyone know what I'm missing? I *think* I'm close...but I'm not sure what I need to do.
Thank you!
Ray
I'm new to ballgown and one of the things I'd like to do is to create a PCA plot using R / ggplot2's ggfortify. I have something like this so far:
Code:
pheno_data <- read.csv ("phenodata.csv") bg = ballgown (...) bg_filter = subset (bg, "rowVars (gexpr (bg)) > 1", genomesubset=TRUE) y <- log2 (gexpr (bg_filter) + 1) pca <- prcomp (t (y)) autoplot (pca)
As the above web page describes, I can colour it by giving it a "colour = 'Species'" argument...this is a vector which lists the sample names (as a factor).
Does anyone know what I'm missing? I *think* I'm close...but I'm not sure what I need to do.
Thank you!
Ray
Comment