Thanks for the answer! It works well in this case. But my situation is a little different and this solution doesn't work. Labels have been created as key-value pairs by ifelse statements before legendLabels().
keyvals.color <- ifelse(
rownames(res) %in% Acinetobacter, 'gold',
ifelse(rownames(res) %in% Burkholderia, 'red',
ifelse(rownames(res) %in% Escherichia,'green',
ifelse(rownames(res) %in% Pseudomonas, 'blue',
ifelse(rownames(res) %in% Yersinia, 'pink','black'
)))))
names(keyvals.color)[keyvals.color == 'gold'] <- 'Acinetobacter'
names(keyvals.color)[keyvals.color == 'red'] <- 'Burkholderia'
names(keyvals.color)[keyvals.color == 'green'] <- 'Escherichia'
names(keyvals.color)[keyvals.color == 'blue'] <- 'Pseudomonas'
names(keyvals.color)[keyvals.color == 'pink'] <- 'Yersinia'
names(keyvals.color)[keyvals.color == 'black'] <- 'unpassed'
EnhancedVolcano(res_after1,
ylab=bquote(~-Log[10]~italic(P[adjusted])),
lab = rownames(res_after1),
title='A-ARGs',
drawConnectors=TRUE,
legendPosition='right',
legendLabels = c(expression(italic(Acinetobacter)),expression(italic(Burkholderia)),expression(italic(Escherichia)),expression(italic(Pseudomonas)),expression(italic(Yersinia)),expression(italic(unpassed))),
#.legend = c('Acinetobacter','Burkholderia','Escherichia','Pseudomonas','Yersinia','unpassed'),
subtitle=NULL,
caption = NULL,
colCustom = keyvals.color,
colAlpha=1,
legendLabSize=8,
x = 'log2FoldChange', FCcutoff=1.5, axisLabSize = 15,
y = 'padj', ylim=c(0, -log10(10e-10)), pCutoff=0.05,
pointSize=3.0,
labSize=3.0,
xlim = c(-7, 7))
I ran the code the labels were not italicized. So in this case, legendLabels() is not working. Is there a way to italicize the label in this case?


Hi Kevin
I have been able to plot the data as a volcano plot. However, I have some data points which share the exact same adjusted p value and a similar FC. And so the labels are probably getting overlapped and one label is obscuring the one closest to it. Please let me know if I can change the coordinates of the annotations/labels or is there a way to spread them out so all the labels are visible.
Cheers Farheen
See: https://www.bioconductor.org/packages/release/bioc/vignettes/EnhancedVolcano/inst/doc/EnhancedVolcano.html#fit-more-labels-by-adding-connectors