Entering edit mode
2.5 years ago
biology_inform
▴
50
Hi all, I drew a volcano plot with EnhancedVolcano but I want to put front my specific labeled point. How can I do that
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 = "")
Hi, it is not clear what you want to do? Have you not already generated what you wanted to do?
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: