Text Venn diagram
textvenn(
setlist,
sets = seq_along(setlist),
overlap_type = c("concordance", "overlap", "each", "agreement"),
set_colors = NULL,
spacing = 5,
padding = 1,
inverse_title = TRUE,
inverse_counts = FALSE,
color_by_counts = TRUE,
return_items = TRUE,
unicode = TRUE,
big.mark = ",",
sep = "&",
blend_preset = "ryb",
curate_df = NULL,
verbose = FALSE,
...
)
list
of item vectors; list
of vectors named by item;
incidence matrix
with values c(0, 1)
or c(FALSE, TRUE)
, or
c(-1, 0, 1)
.
integer
vector
as index to setlist
, used to
pull out a subset of the list elements. This subset is useful
because the set colors are defined for the full setlist
,
which allows the subset of colors to be consistent for each set.
NULL
or character
vector
that contains
R-compatible colors. When set_colors
is NULL
, categorical
colors are defined using colorjam::rainbowJam()
. When
set_colors
is defined, the values are recycled to the total
number of sets represented by setlist
.
integer
values indicating the character
spacing and padding around labels printed to the console output.
logical
indicating whether
to inverse the color, when inverse_title=TRUE
then each Venn
set is printed on colored background, when inverse_title=FALSE
,
each set is printed with colored text with no background color.
logical
default TRUE, whether to return items
in the data.frame
in column "items"
.
This argument is passed to signed_overlaps()
.
logical
passed to curate_venn_labels()
indicating whether the directional label can include special
Unicode characters.
character
passed to format()
for numeric labels.
character
string passed as preset
to
colorjam::blend_colors()
to define the color wheel used
during color blending operations.
data.frame
or NULL
passed to curate_venn_labels()
.
logical
indicating whether to print verbose output.
data.frame
returned using invisible()
, from the
output of signed_overlaps()
.
This function is a very simple method to print a Venn diagram using text, intended to be displayed using mono-spaced font on an R console.
Other venndir core:
render_venndir()
,
signed_overlaps()
,
venn_meme()
,
venndir()
setlist <- make_venn_test(n_items=100, do_signed=TRUE)
# two-way Venn by default shows concordance
textvenn(setlist, sets=c(1,2))
#> set_A ↑: 13 set_A&set_B X: 2 set_B ↑: 6
#> 26 ↓: 13 6 ↑↑: 3 10 ↓: 4
#> ↓↓: 1
# without signed directionality use overlap_type="overlap"
textvenn(setlist, sets=c(1,2), overlap_type="overlap")
#> set_A set_A&set_B set_B
#> 26 6 10
# three-way Venn showing each signed directionality
textvenn(setlist, sets=c(1,2,3), overlap_type="each")
#> set_A&set_B ↑↑: 3
#> 5 ↓↑: 1
#> set_A ↑: 9 ↓↓: 1 set_B ↑: 6
#> 18 ↓: 9 10 ↓: 4
#>
#> set_A&set_B&set_C ↓↑↑: 1
#> 1
#> set_A&set_C ↑↑: 2 set_B&set_C ↑↑: 0
#> 8 ↑↓: 2 0
#> ↓↑: 2
#> ↓↓: 2
#> set_C ↑: 1
#> 6 ↓: 5
# larger number of items
setlist <- make_venn_test(n_items=1000000, sizes=200000, do_signed=TRUE)
# text Venn with directionality
textvenn(setlist, sets=c(1,2,3), "agreement")
#> set_A&set_B X: 7,975
#> 31,988 ‖: 24,013
#> set_A ‖: 128,007 set_B ‖: 128,192
#> 128,007 128,192
#>
#> set_A&set_B&set_C X: 3,557
#> 8,054 ‖: 4,497
#> set_A&set_C X: 16,069 set_B&set_C X: 7,903
#> 31,951 ‖: 15,882 31,766 ‖: 23,863
#>
#>
#> set_C ‖: 128,229
#> 128,229
# basic text Venn with directionality
textvenn(setlist, sets=c(1,2,3), "each")
#> set_A&set_B ↑↑: 11,990
#> 31,988 ↑↓: 4,007
#> set_A ↑: 64,078 ↓↑: 3,968 set_B ↑: 63,910
#> 128,007 ↓: 63,929 ↓↓: 12,023 128,192 ↓: 64,282
#>
#> set_A&set_B&set_C ↑↑↑: 2,243 ↓↑↑: 757
#> 8,054 ↑↑↓: 766 ↓↑↓: 243
#> set_A&set_C ↑↑: 7,950 ↑↓↑: 287 ↓↓↑: 756 set_B&set_C ↑↑: 11,919
#> 31,951 ↑↓: 7,902 ↑↓↓: 748 ↓↓↓: 2,254 31,766 ↑↓: 3,918
#> ↓↑: 8,167 ↓↑: 3,985
#> ↓↓: 7,932 ↓↓: 11,944
#> set_C ↑: 64,000
#> 128,229 ↓: 64,229