Learn R Programming

VennItem (version 1.1.0)

vennItem: Create Venn Diagram with Items

Description

Draws a 2- or 3-set Venn diagram with items listed in regions.

Usage

vennItem(
  sets,
  ncol_items = 1,
  max_items_per_region = Inf,
  fill_alpha = 0.25,
  outline_size = 0.8,
  palette = NULL,
  text_size = 3.5,
  font_family = "mono",
  title = NULL,
  legend = "none",
  sort_items = TRUE,
  show_set_labels = TRUE,
  set_label_size = text_size * 1.5,
  set_label_family = font_family,
  set_label_nudge = 0.25,
  set_label_angles = NULL
)

Value

A ggplot object.

Arguments

sets

Named list of character vectors.

ncol_items

Number of columns for items drawn within each section.

max_items_per_region

Show top n items only. Set to 0 for classic set size Venn.

fill_alpha

Fill opacity.

outline_size

Circle stroke size.

palette

Vector of custom fill colours.

text_size

Size of item text.

font_family

Font of item text, monospace recommended.

title

Plot title.

legend

Show fill legend.

sort_items

Sort items alphabetically within sections.

show_set_labels

Label circles with set names.

set_label_size

Size of set names.

set_label_family

Font of set names.

set_label_nudge

Distance of set names from circle.

set_label_angles

Angle of set name from center of plot.

Examples

Run this code
sets <- list(A = c("apple","banana"), B = c("banana","kiwi"),
 C = c("banana","kiwi","apple","pear"))
vennItem(sets)
big_sets <- list(A = c("apple","banana","durian","lychee",
"grapes","pear","melon"),
B = c("banana","kiwi","satsuma","orange","lemon","lime"),
C = c("banana","kiwi","apple","pear","coconut"))
vennItem(big_sets, ncol_items = 2)

Run the code above in your browser using DataLab