Entering edit mode
20 months ago
arsa ▴ 20
I'm trying to plot a volcano plot with ggplot's vplot. My issue is that I want the colored dots on the front layer rather than the back layer. Is there a way? For example: In the figure I want all the red dots to pop up but I see few of them are masked by the grey dots.
It could have been simpler if you had posted the code... In case you plot the dots with separate plot orders, you can just change the order, plot gray first, then red. In case you use a color vector, you may need to subset the data points for the red dots and plot the explicitly after those for the gray ones.
Also, please edit your question to be a question, not a forum post.
Lets say I have subset the data like followning:
GeneA <- compare_results[grep("GeneA",compare_results$gene),]
Other <- compare_results[grep("Other",compare_results$gene),]
ggplot(GeneA, aes(x=log2FoldChange, y= -log10(padj)))+geom_point()+xlim(-8.5, 8.5)
ggplot(Other, aes(x=log2FoldChange, y= -log10(padj)))+geom_point()+xlim(-8.5, 8.5)
This gives me unique two plots. Please can you guide me how can I plot these two one after another like you mentioned in the comment.
ggplot2the points are plotted as they are ordered in the input data. So you can sort your input data so that your points of interest are plotted afterwards. See this example (I plotted some of the points very big so that they would hide the other points of interest):