Prepare Venn data
process_set_data(venn)
process_region_data(venn, sep = "/", specific = TRUE)
a tibble
ggVennDiagram, by default, only return the specific subsets of a region. However, sometimes, we want to show all the overlapping items for two or more sets. For example: https://github.com/gaospecial/ggVennDiagram/issues/64 Therefore, we add a 'specific' switch to this function. While 'specific = FALSE', the seperator will be changed from "/" to "~", and all the overlapping items will be returned. This feature is useful in plotting upset plot.
x = list(
A = sample(letters, 8),
B = sample(letters, 8),
C = sample(letters, 8),
D = sample(letters, 8)
)
venn = Venn(x)
process_set_data(venn)
#> # A tibble: 4 × 4
#> id name item count
#> <chr> <chr> <named list> <int>
#> 1 1 A <chr [8]> 8
#> 2 2 B <chr [8]> 8
#> 3 3 C <chr [8]> 8
#> 4 4 D <chr [8]> 8
process_region_data(venn)
#> # A tibble: 15 × 4
#> id name item count
#> <chr> <chr> <list> <int>
#> 1 1 A <chr [2]> 2
#> 2 2 B <chr [2]> 2
#> 3 3 C <chr [5]> 5
#> 4 4 D <chr [4]> 4
#> 5 1/2 A/B <chr [2]> 2
#> 6 1/3 A/C <chr [3]> 3
#> 7 1/4 A/D <chr [0]> 0
#> 8 2/3 B/C <chr [0]> 0
#> 9 2/4 B/D <chr [3]> 3
#> 10 3/4 C/D <chr [0]> 0
#> 11 1/2/3 A/B/C <chr [0]> 0
#> 12 1/2/4 A/B/D <chr [1]> 1
#> 13 1/3/4 A/C/D <chr [0]> 0
#> 14 2/3/4 B/C/D <chr [0]> 0
#> 15 1/2/3/4 A/B/C/D <chr [0]> 0