get_venn_polygon_shapes: Get Venn shapes as polygon_list

get_venn_polygon_shapesR Documentation

Get Venn shapes as polygon_list

Description

Get Venn shapes as polygon_list

Usage

get_venn_polygon_shapes(
  counts,
  proportional = FALSE,
  sep = "&",
  circles_only = FALSE,
  circle_nudge = NULL,
  rotate_degrees = 0,
  return_type = c("polygon_list", "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.

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.

Value

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

See Also

Other venndir polygons: bbox_polygon_list(), eulerr_to_polygon_list(), get_largest_polygon_list(), intersect_polygon_list(), labelr_polygon_list(), minus_polygon_list(), nudge_polygon_coords(), nudge_polygon_list(), plot_polygon_list(), polygon_areas(), polygon_circles(), polygon_ellipses(), polygon_list_labelr(), polygon_list_to_xy_list(), rescale_polygon_list(), simple_ellipse(), union_polygon_list(), xy_list_to_polygon_list()

Examples

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

venn_polygon_list <- get_venn_polygon_shapes(counts)
plot_polygon_list(venn_polygon_list, col=venn_colors)

venn_polygon_list <- get_venn_polygon_shapes(counts, proportional=TRUE)
plot_polygon_list(venn_polygon_list, col=venn_colors)

# TODO: examples showing circle_nudge, rotate_degrees
jpdf <- get_venn_polygon_shapes(counts, return_type="JamPolygon")

counts4 <- c(A=1, B=2, `A&B`=3, C=4, `C&D`=2, D=3, `A&C`=2, `A&D`=1, `A&B&C&D`=3)
jpdf <- get_venn_polygon_shapes(counts4, return_type="JamPolygon")


jmw86069/venndir documentation built on June 15, 2024, 1:52 p.m.