Creates a Venn diagram with four sets.
draw.quad.venn(area1, area2, area3, area4, n12, n13, n14, n23, n24,
n34, n123, n124, n134, n234, n1234, category = rep("",
4), lwd = rep(2, 4), lty = rep("solid", 4), col =
rep("black", 4), fill = NULL, alpha = rep(0.5, 4),
label.col = rep("black", 15), cex = rep(1, 15),
fontface = rep("plain", 15), fontfamily = rep("serif",
15), cat.pos = c(-15, 15, 0, 0), cat.dist = c(0.22,
0.22, 0.11, 0.11), cat.col = rep("black", 4), cat.cex
= rep(1, 4), cat.fontface = rep("plain", 4),
cat.fontfamily = rep("serif", 4), cat.just =
rep(list(c(0.5, 0.5)), 4), 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, ...)
The size of the first set
The size of the second set
The size of the third set
The size of the fourth set
The size of the intersection between the first and the second set
The size of the intersection between the first and the third set
The size of the intersection between the first and the fourth set
The size of the intersection between the second and the third set
The size of the intersection between the second and the fourth set
The size of the intersection between the third and the fourth set
The size of the intersection between the first, second and third sets
The size of the intersection between the first, second and fourth sets
The size of the intersection between the first, third and fourth sets
The size of the intersection between the second, third and fourth sets
The size of the intersection between all four sets
A vector (length 4) of strings giving the category names of the sets
A vector (length 4) of numbers giving the line width of the circles' circumferences
A vector (length 4) giving the dash pattern of the circles' circumferences
A vector (length 4) giving the colours of the circles' circumferences
A vector (length 4) giving the colours of the circles' areas
A vector (length 4) giving the alpha transparency of the circles' areas
A vector (length 15) giving the colours of the areas' labels
A vector (length 15) giving the size of the areas' labels
A vector (length 15) giving the fontface of the areas' labels
A vector (length 15) giving the fontfamily of the areas' labels
A vector (length 4) giving the positions (in degrees) of the category names along the circles, with 0 (default) at 12 o'clock
A vector (length 4) giving the distances (in npc units) of the category names from the edges of the circles (can be negative)
A vector (length 4) giving the size of the category names
A vector (length 4) giving the colours of the category names
A vector (length 4) giving the fontface of the category names
A vector (length 4) giving the fontfamily of the category names
List of 4 vectors of length 2 indicating horizontal and vertical justification of each category name
Number of degrees to rotate the entire diagram
A vector (length 2) indicating (x,y) of the rotation centre
Boolean indicating whether the function is to automatically draw the diagram before returning the gList object or not
A function or string used to rescale areas
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
If one of the elements in print.mode is 'percent', then this is how many significant digits will be kept
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
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 margin
, which indicates amount of whitespace around the final diagram in npc units
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.
The function defaults to placing the ellipses so that area1 corresponds to lower left, area2 corresponds to lower right, area3 corresponds to middle left and area4 corresponds to middle right. Refer to the example below to see how the 31 partial areas are ordered. Arguments with length of 15 (label.col, cex, fontface, fontfamily) will follow the order in the example.
# NOT RUN {
# Reference four-set diagram
venn.plot <- draw.quad.venn(
area1 = 72,
area2 = 86,
area3 = 50,
area4 = 52,
n12 = 44,
n13 = 27,
n14 = 32,
n23 = 38,
n24 = 32,
n34 = 20,
n123 = 18,
n124 = 17,
n134 = 11,
n234 = 13,
n1234 = 6,
category = c("First", "Second", "Third", "Fourth"),
fill = c("orange", "red", "green", "blue"),
lty = "dashed",
cex = 2,
cat.cex = 2,
cat.col = c("orange", "red", "green", "blue")
);
# Writing to file
tiff(filename = "Quad_Venn_diagram.tiff", compression = "lzw");
grid.draw(venn.plot);
dev.off();
# }
Run the code above in your browser using DataLab