View source: R/draw.quintuple.venn.R

draw.quintuple.venn | R Documentation |

Creates a Venn diagram with five sets.

draw.quintuple.venn(area1, area2, area3, area4, area5, n12, n13, n14, n15, n23, n24, n25, n34, n35, n45, n123, n124, n125, n134, n135, n145, n234, n235, n245, n345, n1234, n1235, n1245, n1345, n2345, n12345, category = rep("", 5), lwd = rep(2, 5), lty = rep("solid", 5), col = rep("black", 5), fill = NULL, alpha = rep(0.5, 5), label.col = rep("black", 31), cex = rep(1, 31), fontface = rep("plain", 31), fontfamily = rep("serif", 31), cat.pos = c(0, 287.5, 215, 145, 70), cat.dist = rep(0.2, 5), cat.col = rep("black", 5), cat.cex = rep(1, 5), cat.fontface = rep("plain", 5), cat.fontfamily = rep("serif", 5), cat.just = rep(list(c(0.5, 0.5)), 5), rotation.degree = 0, rotation.centre = c(0.5, 0.5), ind = TRUE, cex.prop = NULL, print.mode = "raw", sigdigs = 3, direct.area = FALSE, area.vector = 0, ...)

`area1` |
The size of the first set |

`area2` |
The size of the second set |

`area3` |
The size of the third set |

`area4` |
The size of the fourth set |

`area5` |
The size of the fifth set |

`n12` |
The size of the intersection between the first and the second set |

`n13` |
The size of the intersection between the first and the third set |

`n14` |
The size of the intersection between the first and the fourth set |

`n15` |
The size of the intersection between the first and the fifth set |

`n23` |
The size of the intersection between the second and the third set |

`n24` |
The size of the intersection between the second and the fourth set |

`n25` |
The size of the intersection between the second and the fifth set |

`n34` |
The size of the intersection between the third and the fourth set |

`n35` |
The size of the intersection between the third and the fifth set |

`n45` |
The size of the intersection between the fourth and the fifth set |

`n123` |
The size of the intersection between the first, second and third sets |

`n124` |
The size of the intersection between the first, second and fourth sets |

`n125` |
The size of the intersection between the first, second and fifth sets |

`n134` |
The size of the intersection between the first, third and fourth sets |

`n135` |
The size of the intersection between the first, third and fifth sets |

`n145` |
The size of the intersection between the first, fourth and fifth sets |

`n234` |
The size of the intersection between the second, third and fourth sets |

`n235` |
The size of the intersection between the second, third and fifth sets |

`n245` |
The size of the intersection between the second, fourth and fifth sets |

`n345` |
The size of the intersection between the third, fourth and fifth sets |

`n1234` |
The size of the intersection between the first, second, third and fourth sets |

`n1235` |
The size of the intersection between the first, second, third and fifth sets |

`n1245` |
The size of the intersection between the first, second, fourth and fifth sets |

`n1345` |
The size of the intersection between the first, third, fourth and fifth sets |

`n2345` |
The size of the intersection between the second, third, fourth and fifth sets |

`n12345` |
The size of the intersection between all five sets |

`category` |
A vector (length 5) of strings giving the category names of the sets |

`lwd` |
A vector (length 5) of numbers giving the line width of the circles' circumferences |

`lty` |
A vector (length 5) giving the dash pattern of the circles' circumferences |

`col` |
A vector (length 5) giving the colours of the circles' circumferences |

`fill` |
A vector (length 5) giving the colours of the circles' areas |

`alpha` |
A vector (length 5) giving the alpha transparency of the circles' areas |

`label.col` |
A vector (length 31) giving the colours of the areas' labels |

`cex` |
A vector (length 31) giving the size of the areas' labels |

`fontface` |
A vector (length 31) giving the fontface of the areas' labels |

`fontfamily` |
A vector (length 31) giving the fontfamily of the areas' labels |

`cat.pos` |
A vector (length 5) giving the positions (in degrees) of the category names along the circles, with 0 (default) at 12 o'clock |

`cat.dist` |
A vector (length 5) giving the distances (in npc units) of the category names from the edges of the circles (can be negative) |

`cat.cex` |
A vector (length 5) giving the size of the category names |

`cat.col` |
A vector (length 5) giving the colours of the category names |

`cat.fontface` |
A vector (length 5) giving the fontface of the category names |

`cat.fontfamily` |
A vector (length 5) giving the fontfamily of the category names |

`cat.just` |
List of 5 vectors of length 2 indicating horizontal and vertical justification of each category name |

`rotation.degree` |
Number of degrees to rotate the entire diagram |

`rotation.centre` |
A vector (length 2) indicating (x,y) of the rotation centre |

`ind` |
Boolean indicating whether the function is to automatically draw the diagram before returning the gList object or not |

`cex.prop` |
A function or string used to rescale areas |

`print.mode` |
Can be either 'raw' or 'percent'. This is the format that the numbers will be printed in. Can pass in a vector with the second element being printed under the first |

`sigdigs` |
If one of the elements in print.mode is 'percent', then this is how many significant digits will be kept |

`direct.area` |
If this is equal to true, then the vector passed into area.vector will be directly assigned to the areas of the corresponding regions. Only use this if you know which positions in the vector correspond to which regions in the diagram |

`area.vector` |
An argument to be used when direct.area is true. These are the areas of the corresponding regions in the Venn Diagram |

`...` |
Additional arguments to be passed, including |

The function defaults to placing the ellipses representing the areas 1 to 5 in a counterclockwise fashion. Refer to the example below to see how the 31 partial areas are ordered. Arguments with length of 31 (label.col, cex, fontface, fontfamily) will follow the order in the example.

Returns an object of class gList containing the grid objects that make up the diagram. Also displays the diagram in a graphical device unless specified with ind = FALSE. Grid::grid.draw can be used to draw the gList object in a graphical device.

Hanbo Chen

# Reference five-set diagram venn.plot <- draw.quintuple.venn( area1 = 301, area2 = 321, area3 = 311, area4 = 321, area5 = 301, n12 = 188, n13 = 191, n14 = 184, n15 = 177, n23 = 194, n24 = 197, n25 = 190, n34 = 190, n35 = 173, n45 = 186, n123 = 112, n124 = 108, n125 = 108, n134 = 111, n135 = 104, n145 = 104, n234 = 111, n235 = 107, n245 = 110, n345 = 100, n1234 = 61, n1235 = 60, n1245 = 59, n1345 = 58, n2345 = 57, n12345 = 31, category = c("A", "B", "C", "D", "E"), fill = c("dodgerblue", "goldenrod1", "darkorange1", "seagreen3", "orchid3"), cat.col = c("dodgerblue", "goldenrod1", "darkorange1", "seagreen3", "orchid3"), cat.cex = 2, margin = 0.05, cex = c(1.5, 1.5, 1.5, 1.5, 1.5, 1, 0.8, 1, 0.8, 1, 0.8, 1, 0.8, 1, 0.8, 1, 0.55, 1, 0.55, 1, 0.55, 1, 0.55, 1, 0.55, 1, 1, 1, 1, 1, 1.5), ind = TRUE ); # Writing to file tiff( filename = tempfile( pattern = 'Quintuple_Venn_diagram', fileext = '.tiff' ), compression = "lzw" ); grid.draw(venn.plot); dev.off();

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.