Coloring specific areas in Venn Diagrams in R

998 views Asked by At

I'm using the 'VennDiagram' package in R. I know how to make venn diagrams, but is there any way to color specific areas of the diagram only? For example, if I had the categories A1, A2, and A3, I only want to color the area within A1 that doesn't overlap with the other categories.

1

There are 1 answers

0
josliber On

The VennDiagram package doesn't give full control over the colors of the seven plotting areas within a 3-category venn diagram, but it does allow you to control the color of each individual circle. In your case, you can get the desired effect by setting the color of the first region to blue and the remaining regions to white and removing the transparency:

library(VennDiagram)
draw.triple.venn(
  area1 = 65,
  area2 = 75,
  area3 = 85,
  n12 = 35,
  n23 = 15,
  n13 = 25,
  n123 = 5,
  category = c("First", "Second", "Third"),
  fill = c("blue", "white", "white"),
  alpha=c(1, 1, 1),
  lty=c(1, 1, 1),
  cex = 2,
  cat.cex = 2,
  cat.col = c("black", "black", "black")
)

enter image description here