Install and load the required package (if not already installed)

## install.packages("VennDiagram")
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger

Create example data

set.seed(1)
groupA <- sample(1:100, 30)
groupB <- sample(1:100, 40)
groupC <- sample(1:100, 35)

Create the Venn diagram

venn.diagram(
  disable.logging = TRUE,
  x = list(GroupA = groupA, GroupB = groupB, GroupC = groupC),
  filename = "venn_diagram.png",
  imagetype = "png",
  col = "transparent",
  fill = c("cornflowerblue", "darkorange1", "darkseagreen2"),
  alpha = 0.5,
  cex = 1.5,
  main = "My Venn Diagram",
  fontface = "bold",
  fontfamily = "sans",
  cat.col = c("cornflowerblue", "darkorange1", "darkseagreen2"),
  cat.cex = 1.2,
  cat.fontface = "bold",
  margin = 0.1
)
## INFO [2023-11-23 09:19:51] $disable.logging
## INFO [2023-11-23 09:19:51] [1] TRUE
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $x
## INFO [2023-11-23 09:19:51] list(GroupA = groupA, GroupB = groupB, GroupC = groupC)
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $filename
## INFO [2023-11-23 09:19:51] [1] "venn_diagram.png"
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $imagetype
## INFO [2023-11-23 09:19:51] [1] "png"
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $col
## INFO [2023-11-23 09:19:51] [1] "transparent"
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $fill
## INFO [2023-11-23 09:19:51] c("cornflowerblue", "darkorange1", "darkseagreen2")
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $alpha
## INFO [2023-11-23 09:19:51] [1] 0.5
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $cex
## INFO [2023-11-23 09:19:51] [1] 1.5
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $main
## INFO [2023-11-23 09:19:51] [1] "My Venn Diagram"
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $fontface
## INFO [2023-11-23 09:19:51] [1] "bold"
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $fontfamily
## INFO [2023-11-23 09:19:51] [1] "sans"
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $cat.col
## INFO [2023-11-23 09:19:51] c("cornflowerblue", "darkorange1", "darkseagreen2")
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $cat.cex
## INFO [2023-11-23 09:19:51] [1] 1.2
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $cat.fontface
## INFO [2023-11-23 09:19:51] [1] "bold"
## INFO [2023-11-23 09:19:51] 
## INFO [2023-11-23 09:19:51] $margin
## INFO [2023-11-23 09:19:51] [1] 0.1
## INFO [2023-11-23 09:19:51]
## [1] 1

The above code generates the png file “venn_diagram.png”:

VennDiagram

sessionInfo()
## R version 4.3.2 (2023-10-31)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Manjaro Linux
## 
## Matrix products: default
## BLAS:   /usr/lib/libblas.so.3.11.0 
## LAPACK: /usr/lib/liblapack.so.3.11.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: America/Toronto
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] grid      stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
## [1] VennDiagram_1.7.3   futile.logger_1.4.3
## 
## loaded via a namespace (and not attached):
##  [1] digest_0.6.33        R6_2.5.1             bookdown_0.36       
##  [4] fastmap_1.1.1        xfun_0.41            blogdown_1.18       
##  [7] cachem_1.0.8         knitr_1.45           htmltools_0.5.7     
## [10] rmarkdown_2.25       futile.options_1.0.1 cli_3.6.1           
## [13] sass_0.4.7           jquerylib_0.1.4      compiler_4.3.2      
## [16] rstudioapi_0.15.0    tools_4.3.2          evaluate_0.23       
## [19] bslib_0.5.1          yaml_2.3.7           formatR_1.14        
## [22] jsonlite_1.8.7       rlang_1.1.2          lambda.r_1.2.4