Get Venn shapes as polygon_list

get_venn_polygon_shapes(
  counts,
  proportional = FALSE,
  sep = "&",
  circles_only = FALSE,
  circle_nudge = NULL,
  rotate_degrees = 0,
  return_type = c("JamPolygon"),
  ...
)

Arguments

counts

integer vector whose names represent set overlaps, where set names are separated by sep delimiter.

proportional

logical indicating whether to create proportional circles, where proportional=FALSE creates standard Venn diagram, and proportional=TRUE creates a Euler diagram.

sep

character delimiter used to separate set names in names(counts).

circles_only

logical indicating whether to force Venn 4-way diagram to use only circles; or passed to eulerr::euler() to force it to return circles instead of allowing ellipse shapes.

circle_nudge

list of numeric vectors each length 2, whose names match set names derived from counts. For example if counts=c(set_A=5, set_B=10, "setA&set_B"=3), then to nudge the set_A circle, use circle_nudge=list(set_A=c(1, 0)). This argument is intended to allow manipulation of specific circle or ellipse positions for aesthetic effects. Particularly for proportional Euler diagrams, sometimes the algorithm places circles in non-ideal locations

rotate_degrees

numeric value indicating rotation in degrees for the entire set of shapes. This argument is intended to change the overall orientation, for example so that certain sets are at the top.

...

additional arguments are ignored.

Value

list in polygon_list format with "x" and "y" elements, or when return_type="JamPolygon" it returns JamPolygon.

Details

This function takes a Venn overlap counts and creates corresponding circles or ellipses that represent either a Venn diagram, or proportional Venn (Euler) diagram.

For non-proportional Venn diagrams, this function accepts up to 5 sets, although the 5-way Venn diagram is not visually intuitive.

For proportional Euler diagrams, this function simply passes the count vector to eulerr::euler() and returns the output. That function accepts more sets, however not all overlaps may be represented in the output.

See also

Other venndir polygons: simple_ellipse()

Examples

counts <- c(A=1, B=2, `A&B`=3, C=4)
venn_colors <- colorjam::rainbowJam(3, alpha=0.5);

vjp <- get_venn_polygon_shapes(counts, return_type="JamPolygon")
plot(vjp, fill=venn_colors)


vjp <- get_venn_polygon_shapes(counts,
   return_type="JamPolygon",
   proportional=TRUE)
plot(vjp, fill=venn_colors)