5

I have been requested to redo the following Venn diagram in R with Arial font and without the group names... Looking at VennDiagram manual I do not see how I can do it...

This is my MWE:

#install.packages("VennDiagram")
library(VennDiagram)

a <- c(1,2,3,4,5,6)
b <- c(4,5,6,7,8,9,10,11,12)
c <- c(1,2,10,11,12,5,13,14,15,16)

venn.diagram(list("A" = a, "B" = b, "C" = c),
                 fill = c("red", "blue", "green"), alpha = c(0.5, 0.5, 0.5),
                 cat.cex = .75, cex = .75, lty =2, lwd =0.5, fontfamily ="serif",
                 filename = "test.tiff", imagetype = "tiff",
                 height = 3000, width = 3000, resolution = 1500, units = "px",
                 main="TITLE", main.pos=c(0.1,1.05), main.fontfamily="serif", main.cex=.75)

test image

Is it even possible to remove the group names A, B, and C, and change the font family to Arial, or I should think about another approach instead of R?

Besides, could it be possible to add a color legend?

zx8754
  • 52,746
  • 12
  • 114
  • 209
DaniCee
  • 2,397
  • 6
  • 36
  • 59
  • Seems you have to pass empty strings to `category = rep("", 3)` or you could set the size to zero,,, `cat.cex=0` – user20650 Jun 28 '16 at 13:21

2 Answers2

5

To install Arial fonts, use this manual. Then you should be able to change fontfamily ="Arial" and main.fontfamily="serif".

J_F
  • 9,956
  • 2
  • 31
  • 55
3

Really rough guess, but do you see:

fontfamily ="serif",

and:

main.fontfamily="serif"

Try changing them to Arial and see if it works. I haven't got time to check this out at my computer right now so this is a super fast guess.

To remove the group names, you could probably change them where you assign them in the array:

venn.diagram(list("A" = a, "B" = b, "C" = c)

Here you can possibly call them what you'd like

Jamie Belcher
  • 123
  • 2
  • 13
  • Ops I thought writing Arial didn't work, cause I had written it in "main.fontface", not "main.fontfamiy" hehe. However, I don't seem to be able to remove the A, B, C – DaniCee Jun 28 '16 at 09:35
  • Never used this before so it could be a shot in the dark, can you try shaping the array to look like this: venn.diagram(list("" = a, "" = b, "" = c) Or even better, try not listing them at all, not sure how it'll turn out or effect the rest of your code though – Jamie Belcher Jun 28 '16 at 09:47
  • writing it like list(" " = a, " " = b, " " = c) with spaces is the only way to go it seems – DaniCee Jun 28 '16 at 09:48
  • Odd, as that still gives it a title which is just a blank space, no doubt there is a way to completely remove the title. Can you find where you call and display the Title list? Try removing it or editing it – Jamie Belcher Jun 28 '16 at 09:49
  • That's really odd... I'm clueless right now, I'll have time to check this in about an hour or so if it is not solved by then. The last thing I can think of is just removing the listing all together – Jamie Belcher Jun 28 '16 at 10:03