enhanced volcano label point
0
0
Entering edit mode
2.5 years ago

Hi all, I drew a volcano plot with EnhancedVolcano but I want to put front my specific labeled point. How can I do that enter image description here

keyvals <- ifelse(
  Analysis_OsiR_all_gene_summary$id == "BUB1", 'royalblue3',"gray59")
names(keyvals)[keyvals == 'royalblue3'] <- 'BUB1'
names(keyvals)[keyvals == 'gray59'] <- 'Others'
volc <- EnhancedVolcano(Analysis_OsiR_all_gene_summary,
lab = Analysis_OsiR_all_gene_summary$id,
x = 'neg|lfc',
y = 'neg|p-value',
xlab = bquote(~Log[2]~ 'FC (T=14/T=0)'),
selectLab = "BUB1",
pCutoff = 0.1,
FCcutoff = 0.5,
pointSize = c(ifelse( Analysis_OsiR_all_gene_summary$id == "BUB1", 4, 1)),
labSize = 5,

ylim=c(0,6),
axisLabSize = 18,
colAlpha = 1,
legendLabels = c("NS", "NS", "NS", "Negative Selection"),
legendPosition = 'right',
legendLabSize = 12,
legendIconSize = 4.0,
drawConnectors = TRUE,
widthConnectors = 0,
colConnectors = 'black',
arrowheads = FALSE,
colCustom = keyvals,
gridlines.major=FALSE,
gridlines.minor=FALSE,
title = "Met-5A CRISPR Screen Volcano Plot",
subtitle = "")
rnaseq enhancedvolcano • 2.6k views
ADD COMMENT
0
Entering edit mode

Hi, it is not clear what you want to do? Have you not already generated what you wanted to do?

ADD REPLY
1
Entering edit mode

They want the blue dot not being overlapped/hidden by grey. @OP, since it's ggplot the order how the dots are plotted is determined simply by the order of the data.frame you give it. What comes first is plotted first, so elements at the bottom of the data.frame may hide elements on top. Hence, you have to sort the data.frame in a way that the row with the blue dot comes last because then it is printed last, hence it will be on top of everything else. That would be true unless EnhancedVolcano does some sorting internally. If so then save the plot to a variable, e.g. p <- EnhancedVolcano(...) and then change the order of the data manually. That is possible because ggplot saves the relevant input data in the ggplot object.

Here is some crude code example to practice it:

library(ggplot2)

#/ some pathetic example data
dat <- data.frame(x=c(1,2,2), y=c(2,1.1,1.111111), label=c("A", "B", "C"))

#/ blue hides green
gg1 <- ggplot(data=dat, aes(x=x, y=y, color=label)) + geom_point(size=10)
gg1

#/ Way1: Sort the input, so green (B) comes first
green <- which(dat$label=="B")
notgreen <- setdiff(1:nrow(dat), green)
dat_ordered <- dat[c(notgreen, green),]

#/ now green is on top
gg2 <- ggplot(data=dat_ordered, aes(x=x, y=y, color=label)) + geom_point(size=10)
gg2

#/ Way2: Directly change order in the ggplot object
gg3 <- gg1
gg3$data <- gg3$data[c(notgreen, green),]

gg3
ADD REPLY
0
Entering edit mode
library(ggplot2)
library(patchwork)

dat <- data.frame(x=c(1,2,2), y=c(2,1.1,1.111111), label=c("A", "B", "C"))

gg1=ggplot(data=dat, aes(x=x, y=y, color=label)) + 
  geom_point(size=10)
gg2=gg1+
  geom_point(data=dat[dat$label=="B",], aes(x=x, y=y), colour="green", size=10)
gg1+gg2

ggplot

ADD REPLY

Login before adding your answer.

Traffic: 2290 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