venn_wrapper: Venn Diagram Plotting Routine

View source: R/venn_wrapper.R

venn_wrapperR Documentation

Venn Diagram Plotting Routine

Description

A wrapper function for plotting Venn diagrams comprising 2 -> 5 intersections.

Usage

venn_wrapper(
  x,
  main,
  filename = NULL,
  edge.col = "transparent",
  ...,
  colors = seq(length(x)),
  num.cex = 1,
  alpha = 0.25,
  label.col = "gray35",
  fontfamily = "sans",
  main.fontface = "bold",
  sub.fontface = "bold",
  main.col = 1,
  sub.col = "gray35",
  main.cex = 3,
  sub.cex = 1,
  margin = 0.05,
  cat.fontface = "bold",
  cat.cex = 2,
  cat.col = "black",
  cat.fontfamily = "sans",
  rotation.degree = 0
)

Arguments

x

A named list of vectors containing strings to match intersections.

main

Character giving the main title of the diagram

filename

Filename for image output, or if NULL returns the grid object itself

edge.col

describe

...

Additional arguments passed to the underlying plotting routine from VennDiagram::venn.diagram().

colors

describe

num.cex

describe

alpha

describe

label.col

describe

fontfamily

describe

main.fontface

Character giving the fontface (font style) of the main title

sub.fontface

Character giving the fontface (font style) of the subtitle

main.col

Character giving the colour of the main title

sub.col

Character Colour of the subtitle

main.cex

Number giving the cex (font size) of the main title

sub.cex

Number giving the cex (font size) of the subtitle

margin

describe

cat.fontface

describe

cat.cex

describe

cat.col

describe

cat.fontfamily

describe

rotation.degree

Numeric (0-360). Rotation for the entire diagram.

Details

Argument Venn Sizes Class Description
lwd 1,2,3,4,5 numeric Vector giving the width of each circle's circumference
lty 1,2,3,4,5 numeric Vector giving the dash pattern of each circle's circumference
col 1,2,3,4,5 character Vector giving the colour of each circle's circumference
fill 1,2,3,4,5 character Vector giving the colour of each circle's area
alpha 1,2,3,4,5 numeric Vector giving the alpha transparency of each circle's area
label.col 1,2,3,4,5 character Vector giving the colour for each area label (length = 1/3/7/15 based on set-number)
cex 1,2,3,4,5 numeric Vector giving the size for each area label (length = 1/3/7/15 based on set-number)
fontface 1,2,3,4,5 character Vector giving the fontface for each area label (length = 1/3/7/15 based on set-number)
fontfamily 1,2,3,4,5 character Vector giving the fontfamily for each area label (length = 1/3/7/15 based on set-number)
cat.pos 1,2,3,4,5 numeric Vector giving the position (in degrees) of each category name along the circle, with 0 at 12 o'clock
cat.dist 1,2,3,4,5 numeric Vector giving the distance (in npc units) of each category name from the edge of the circle (can be negative)
cat.cex 1,2,3,4,5 numeric Vector giving the size for each category name
cat.col 1,2,3,4,5 character Vector giving the colour for each category name
cat.fontface 1,2,3,4,5 character Vector giving the fontface for each category name
cat.fontfamily 1,2,3,4,5 character Vector giving the fontfamily for each category name
cat.just 1,2,3,4,5 numeric List (length = 1/2/3/4 based on set number) of Vectors of length 2 indicating horizontal and vertical justification for each category name
cat.default.pos 1,2,3 character One of c('outer', 'text') to specify the default location of category names (cat.pos and cat.dist are handled differently)
cat.prompts 2 numeric Boolean indicating whether to display help text on category name positioning or not
margin 1,2,3,4,5 numeric Number giving the amount of whitespace around the diagram in grid units
rotation.degree 1,2,3,4,5 numeric Number of degrees to rotate the entire diagram
rotation.centre 1,2,3,4,5 numeric Vector of length 2 indicating (x,y) of the rotation centre
rotation 3 numeric Number giving the clockwise rotation of a three-set Venn diagram (1, 2, or 3)
reverse 3 logical Reflect the three-set Venn diagram along its central vertical axis of symmetry. Use in combination with rotation to generate all possible set orders
euler.d 2, 3 logical Enable Euler diagrams for two-set and three-set Venn diagrams (Venn Diagrams with moveable circles)
scaled 2, 3 logical Enable scaling for two-set and certain three-set Euler diagrams. (euler.d must be true to enable this)
sep.dist 2, 3 numeric Controls the separation between distinct circles in certain two-set or three-set Euler diagrams.
offset 2, 3 numeric Number between 0 and 1 giving the amount to offset the smaller circle by in the inclusion type of two-set Euler diagram and certain similar three-set Euler diagrams.
inverted 2 logical Flip the two-set Venn diagram along its vertical axis (distinguished from reverse)
ext.text 2 logical Allow external text labels when areas are small
ext.percent 2 numeric A vector (length 3) indicating the proportion that a partial area has to be smaller than to trigger external text placement. The elements allow for individual control of the areas in the order of the first area, second area and intersection area.
ext.pos 2 numeric A vector (length 1 or 2) giving the positions (in degrees) of the external area labels along the circles, with 0 (default) at 12 o'clock
ext.line.lwd 2 numeric Width of line connecting to ext.text
ext.line.lty 2 numeric The dash pattern of the lines connecting the external area labels to their anchor points.
ext.dist 2 numeric Vector of length 1 or 2 indicating length of external line (use negative values to shorten the line )
ext.length 2 numeric Vector of length 1 or 2 indicating the proportion of the external line that is drawn from the anchor to the text

Value

A grob class object which can be sent to a plotting device or printed to file with the filename = argument.

Note

I stole this from the VennDiagram package.

Author(s)

Stu Field

References

See the VennDiagram package.

See Also

VennDiagram::venn.diagram()

Examples

int_list <- lapply(1:3, function(...) sample(LETTERS[1:10], 6)) %>%
  purrr::set_names(c("Larry", "Curly", "Mo"))
venn_wrapper(int_list, num.cex = seq(0.5, 2, length = 7), cat.cex = c(1, 1.5, 2),
             main = "Title Here", sub = "Subtitle")

stufield/stuRpkg documentation built on April 2, 2022, 2:05 p.m.