1. packages
2. tutorial code
1. packages
- VennDiagram: https://rdrr.io/cran/VennDiagram/man/
install.packages("VennDiagram")
library(VennDiagram)
2. tutorial code
- 3 factors VennDiagram
# working directory
getwd()
# seed 설정
set.seed(0)
# 3 factor
# 예시 데이터 생성
set1 <- sample(1:50, 10)
set2 <- sample(1:50, 10)
set3 <- sample(1:50, 10)
# Venn diagram 생성
venn.diagram(
x = list(set1=set1, set2=set2, set3=set3),
filename = "3fac_figure_name.png",
col = "transparent",
fill = c("red", "blue", "green"),
alpha = 0.50,
fontfamily = "serif",
cat.col = c("red", "blue", "green"),
)
- 4 factors VennDiagram
# 4 factor
# 예시 데이터 생성
set1 <- sample(1:50, 10)
set2 <- sample(1:50, 10)
set3 <- sample(1:50, 10)
set4 <- sample(1:50, 10)
# working directory
getwd()
# Venn diagram 생성
venn.diagram(
x = list(set1 = set1, set2 = set2, set3 = set3, set4 = set4),
filename = "4fac_figure_name.png",
col = "transparent",
fill = c("red", "blue", "green", "yellow"),
alpha = 0.50,
fontfamily = "serif",
cat.col = c("red", "blue", "green", "yellow"),
)
- working directory에 그림으로 저장됨