Entering edit mode
Hi,
I have a problem with the labels on a ggvenn venn diagram. I would like to be able to display labels on multiple lines, one line pr. item, which is better if working with large lists/long character vectors. Please see example below.
library(ggvenn)
d<-data.frame(id=paste(LETTERS[1:9]),
A=c(TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,TRUE,FALSE,FALSE),
B=c(FALSE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,FALSE),
C=c(FALSE,FALSE,TRUE,TRUE,FALSE,TRUE,TRUE,TRUE,FALSE))
p<-ggplot(d) +
geom_venn(aes(A=A,B=B,C=C,label=id)) +
coord_fixed()
theme_void()
p#Labels are displayed on one line for each intersection, sep=","..
#I would like labels to be separated by sep/collapse(?)="\n"
p<-ggplot(d) +
geom_venn(aes(A=A,B=B,C=C,label=paste(id, collapse = "\n"))) +
coord_fixed()
theme_void()
p#Does not work...
Any help would be appreciated!
With regards,
Adding this line after after you make the data frame (e.g. before ggplot) makes it a little better:
d$id <- paste0(d$id, "\n")
But still gives labels with annoying leading commas
Hey anders.tondell, please keep in mind that ggvenn is not a Bioconductor package. So, you may get a quicker response by posting on the GitHub issues page for ggvenn, or reaching out to the developers in some other way.
Thanks for help and comments, eugene100hickey and Kevin Blighe! The problem is solved. Package developer Linlin Yan answered my request, see below:
"Yes, there was no quick fix for your answer, since I hard-coded
collapse = ","
in the previous version. So, I updated a new version (0.1.5, https://github.com/yanlinlin82/ggvenn/releases/tag/v0.1.5). More detail could be found at https://github.com/yanlinlin82/ggvenn/issues/9.You may upgrade to this latest version, and try `
or
"