ggplot and DESeq2 PCA plot
1
0
Entering edit mode
2.5 years ago

Hi all, I am trying to convert my PCA plot which is created with DESeq2 to ggplot object but somehow I couldnt manage to do it.

pcaPlot <- plotPCA(dds, intgroup = "types", ntop = nrow(dds), returnData = TRUE) 
annotated_pcaPlot <- ggplot(geom_text(pcaPlot,aes(label=name,group=group)))+geom_text(size = 3,position = position_nudge(y = -0.03))+
  theme_test(base_family = "Arial") +geom_point(aes(color=group))+scale_color_manual(values=c('Purple3','Orangered'))

Error in validate_mapping(): ! mapping must be created by aes() Run rlang::last_error() to see where the error occurred. rlang::last_error() <error/rlang_error> Error in validate_mapping(): ! mapping must be created by aes() --- Backtrace:

  1. ggplot2::ggplot(geom_text(pcaPlot, aes(label = name, group = group)))
  2. ggplot2::geom_text(pcaPlot, aes(label = name, group = group))
  3. ggplot2::layer(...)
  4. ggplot2:::validate_mapping(mapping) Run rlang::last_trace() to see the full context.

I am getting this error when I run like above. Do you have any recommendations ?

ggplot pca rna-seq deseq2 • 2.4k views
ADD COMMENT
0
Entering edit mode

I believe there is an inadequate geom_text after introducing ggplot() that should not be here

ADD REPLY
0
Entering edit mode
2.5 years ago
Trivas ★ 1.8k

Your issue is with the following:

ggplot(geom_text(pcaPlot,aes(label=name,group=group)))

You should instead do:

ggplot(pcaPlot, aes(label = name, group = group))+
    geom_text()+
ADD COMMENT

Login before adding your answer.

Traffic: 2543 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6