v_venn | R Documentation |
Create a Venn Diagram
v_venn(
vc,
mapping = NULL,
data = NULL,
name = NULL,
sets_sep = ",",
...,
serie_id = NULL,
data_id = NULL
)
vc |
A chart initialized with |
mapping |
Default list of aesthetic mappings to use for chart. |
data |
Default dataset to use for chart. If not already
a |
name |
Name for the serie, only used for single serie (no |
sets_sep |
Sets separator. |
... |
Additional parameters for the serie. |
data_id , serie_id |
ID for the data/serie, can be used to further customize the chart with |
A vchart()
htmlwidget
object.
library(vchartr)
# Venn diagram with 2 sets
data.frame(
sets = c("A", "B", "A,B"),
value = c(5, 10, 4)
) %>%
vchart() %>%
v_venn(aes(sets = sets, value = value))
# with more sets
data.frame(
sets = c("A", "B", "C", "A,B", "A,C", "B,C", "A,B,C"),
value = c(8, 10, 12, 4, 4, 4, 2)
) %>%
vchart() %>%
v_venn(aes(sets = sets, value = value))
# More complex example
set.seed(20190708)
genes <- paste("gene",1:1000,sep="")
genes <- list(
A = sample(genes,300),
B = sample(genes,525),
C = sample(genes,440),
D = sample(genes,350)
)
vchart(stack(genes)) %>%
v_venn(aes(category = ind, values = values))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.