enrichplot
enrichplot copied to clipboard
Change title font size and add label for X-axis in barplot of enrichResult?
Hi YuLab,
I am trying to change the font size for the title of the barplot generated by this function but there doesn't seem to be an argument for this, is there any way to do so? Also when I try to add a label for the X-axis with xlab = "x-axis title", it doesn't update this in the rendered plot... Are these functions not possible within barplot.enrichResult?
Thanks!
Hi, it seems x and y are flipped in barplot()
, and the font.size
argument controls size of axis label. You can use ggplot2::labs()
to modify axis and adjust title size withggplot2::theme()
:
library(DOSE)
library(enrichplot)
library(ggplot2)
data(geneList)
de <- names(geneList)[1:100]
x <- enrichDO(de)
barplot(x, title = "I'm the title") +
labs(y = "x-axis title") + #or ylab("x-axis title")
theme(plot.title = element_text(size = 20))
Wow this worked perfectly, thank you for your help!:)