I have a venn diagram that I make with the package VennDiagram. The numbers are above the 100,000.
I would like the number in the iddle to be 150,001, with a comma separator, or 150 000, with a small space in between. Is this possible to do with VennDiagram?
This is my example
library(VennDiagram)
venn.diagram(x = list(A = 1:200000,B = 50000:300000), filename = "../example.tiff")
I dont think you can do this easily. There are two print modes, raw
, and percent
, but these are hard-coded in the function (have a look at VennDiagram::draw.triple.venn
). You can add formats by changing the function (which I wouldn't fancy) or by manually tweaking the grobs (which is done below)
library(VennDiagram)
p <- venn.diagram(x = list(A = 1:200000,B = 50000:300000), filename = NULL)
# Change labels for first three text grobs
# hard-coded three, but it would be the number of text labels
# minus the number of groups passed to venn.diagram
idx <- sapply(p, function(i) grepl("text", i$name))
for(i in 1:3){
p[idx][[i]]$label <-
format(as.numeric(p[idx][[i]]$label), big.mark=",", scientific=FALSE)
}
grid.newpage()
grid.draw(p)