enrichplot
enrichplot copied to clipboard
Changing node text size with emapplot
Dear YuLab,
I am trying to change the node text (something like geom_node_text) with the emapplot function of the enrichplot package.
This is what I have unsuccessfully tried from an enrichResult object that is fine:
> ggoBP@result %>% names()
[1] "ID" "Description" "GeneRatio" "BgRatio" "pvalue"
[6] "p.adjust" "qvalue" "geneID" "Count"
> p <- emapplot(ggoBP, layout = "kk", line_scale = 0.2)
> p + geom_node_label(size = 9, repel = T)
Error: geom_label_repel requires the following missing aesthetics: label
Any suggestion would be welcome!
Hi, as indicated in the error message, you need to specify the label
, here's 2 quick ways to change node size (but old text remains in graph):
p + ggraph::geom_node_text(aes(label = name), size = 9)
p + ggrepel::geom_label_repel(aes(x = x, y = y, label = name), size = 9)
A proper way is to modify emapplot()
to make the node size as an adjustable argument
There is an undocumented option to change the node label size directly using the emapplot function called cex_label_category
. Setting
emapplot(pairwise_termsim(gsea), cex_label_category = 1)
leaves the original, smaller values decrease, larger values increase the font size.
best Niko