Question: (Closed) Error: Aesthetics must be either length 1 or the same as the data (): colour ( EnhancedVolcano )
gravatar for gaom001
9 weeks ago by
gaom00110 wrote:

Hi, I have DEGs file (DEAdf) with log2FC and padjust. I am trying to look at significant dowreguated and upregulated genes in enhanced volcano plot according to my cutoff. To visulize the up and down regulated genes, I customized them into different colors (keyvals.colour), but somehow it came out with the error like the title (Error: Aesthetics must be either length 1 or the same as the data (): colour ) Can anyone help with the solution? many thanks. ( normally, the enhanced volcano plot like this)

enter image description here

library(EnhancedVolcano) mypval=0.05 myfc=2 mypadj=0.05 mylog2fc=log2(myfc)

keyvals.colour <- ifelse( DEAdf$log2FC < -1 & DEAdf$padjust<0.05, 'royalblue', ifelse(DEAdf$log2FC > 1 & DEAdf$padjust<0.05,'red2', ifelse(DEAdf$log2FC<=1 & DEAdf$log2FC >= -1 & DEAdf$padjust >= 0.05,"forestgreen", ifelse(DEAdf$log2FC<=1 & DEAdf$log2FC >=-1 & DEAdf$padjust < 0.05,"yellow", 'grey30'))))

EnhancedVolcano(DEAdf, lab = DEAdf, x = 'log2FC', y = 'padjust', xlim = c(min(DEAdf$log2FC, na.rm=TRUE), max(DEAdf$log2FC, na.rm=TRUE)), ylim=c(0, max(-log10(DEAdf$padjust), na.rm=TRUE) + 1), title="samples", pCutoff=mypadj, FCcutoff=mylog2fc, pointSize = 2.0, labSize = 3.0, colCustom = keyvals.colour, colAlpha = 1, xlab = bquote(~Log[2]~ 'fold change'), ylab = bquote(~-Log[10]~adjusted~italic(P)), legend=c('No significant','Log2FC','Adjusted p-value', 'Adjusted p-value & Log2FC<-1','Adjusted p-value & Log2FC>1'), col=c("grey30", "forestgreen", "Yellow", "royalblue","red2"), legendPosition = 'top', legendLabSize = 10, legendIconSize = 5.0, widthConnectors = 0.2, colConnectors = 'grey30')

rna-seq • 264 views
ADD COMMENTlink modified 9 weeks ago • written 9 weeks ago by gaom00110

Hello gaom001!

We believe that this post does not fit the main topic of this site.

Please ask on

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.


ADD REPLYlink written 9 weeks ago by RamRS30k
Please log in to add an answer.
The thread is closed. No new answers may be added.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1651 users visited in the last hour