cnetplot category names are too long
Hi all,
I am struggling with the visualization of my enrichResult. I want to make a network with cnetplot:
cnetplot(ego,colorEdge = TRUE, circular = TRUE)
But the category names, as you can see on the figure, are too long. Also, I want to color my category nodes corresponding to the edge colors. I've been trying different things and looking into the layers. But as I am a real noob here, I was not able to find a solution.
Can anyone help this noob out? :-)
• 1,563 views
•
link
1 answer
I'm sure someone could find a more elegant solution using stringr::str_wrap, but for a one-time solution I did this:
# my results of enrichGO are stored in this object, go_down
go_down <- setReadable(go_down, 'org.Hs.eg.db', 'ENTREZID')
# simply add a "\n" at an appropriate location in the Description string
go_down@result$Description <- gsub(" in ", " in\n", go_down@result$Description)
# I only had one row in this dataframe, but if you have more you could specify which like:
go_down@result$Description[1] <- gsub(" in ", " in\n", go_down@result$Description)
• 0 views
•
link
Log in to answer this question.