Skip to contents

Create a Venn Diagram

Usage

v_venn(
  vc,
  mapping = NULL,
  data = NULL,
  name = NULL,
  sets_sep = ",",
  ...,
  serie_id = NULL,
  data_id = NULL
)

Arguments

vc

A chart initialized with vchart().

mapping

Default list of aesthetic mappings to use for chart.

data

Default dataset to use for chart. If not already a data.frame, it will be coerced to with as.data.frame.

name

Name for the serie, only used for single serie (no color/fill aesthetic supplied).

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 v_specs().

Value

A vchart() htmlwidget object.

Examples


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))