venn_plot | R Documentation |
Produces ggplot2-based Venn plots for 2, 3 or 4 sets. A Venn diagram shows all possible logical relationships between several sets of data.
venn_plot( ..., names = NULL, show_elements = FALSE, show_sets = FALSE, fill = ggplot_color(4), alpha = 0.5, stroke_color = "white", stroke_alpha = 1, stroke_size = 1, stroke_linetype = "solid", name_color = "black", name_size = 6, text_color = "black", text_size = 4, label_sep = "," )
... |
A list or a comma-separated list of vectors in the same class. If
vector contains duplicates they will be discarded. If the list doesn't have
names the sets will be named as |
names |
By default, the names of the sets are set as the names of the
objects in |
show_elements |
Show set elements instead of count. Defaults to |
show_sets |
Show set names instead of count. Defaults to |
fill |
Filling colors in circles. Defaults to the default ggplot2 color palette. A vector of length 1 will be recycled. |
alpha |
Transparency for filling circles. Defaults to |
stroke_color |
Stroke color for drawing circles. |
stroke_alpha |
Transparency for drawing circles. |
stroke_size |
Stroke size for drawing circles. |
stroke_linetype |
Line type for drawing circles. Defaults to |
name_color |
Text color for set names. Defaults to |
name_size |
Text size for set names. |
text_color |
Text color for intersect contents. |
text_size |
Text size for intersect contents. |
label_sep |
The separator for labs when |
A ggplot object.
Tiago Olivoto tiagoolivoto@gmail.com
library(metan) (A <- letters[1:4]) (B <- letters[2:5]) (C <- letters[3:7]) (D <- letters[4:12]) # create a Venn plot venn_plot(A, B) # Three sets venn_plot(A, B, C) # Four sets venn_plot(A, B, C, D) # Use a list dfs <- list(A = A, B = B, C = C, D = D) venn_plot(dfs, show_elements = TRUE, fill = c("red", "blue", "green", "gray"), stroke_color = "black", alpha = 0.8, text_size = 8, label_sep = ".")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.