Good afternoon,
I am trying for a while now to wrap these labels in my plot (I want that it goes to the next line instead of making a very long line). I tried with the scales package in R, but it seems not to work.. Any chance someone can advise me on this?
p<-ggplot(fgseaResTidy, aes(reorder(topPathways, NES), NES)) +
geom_col(aes(fill=padj<0.05)) + coord_flip() + labs(x="Pathway",
y="Normalized Enrichment Score") + theme_minimal()
p + scale_x_discrete(
labels = function(x) str_wrap(x, width = 10),
drop = FALSE )
Update
Trying with code recommendation from answer below:
fgseaResTidy$pathway=str_replace_all(fgseaResTidy$pathway, "_", " ")
$\endgroup$