limma (version 3.28.14)

venn: Venn Diagrams


Compute classification counts and draw a Venn diagram.


vennCounts(x, include="both") vennDiagram(object, include="both", names=NULL, mar=rep(1,4), cex=c(1.5,1,0.7), lwd=1, circle.col=NULL, counts.col=NULL, show.include=NULL, ...)


a TestResults matrix. This is numeric matrix of 0's, 1's and -1's indicating significance of a test or membership of a set. Each row corresponds to a gene and each column to a contrast or set. Usually created by decideTests.
either a TestResults matrix or a VennCounts object produced by vennCounts.
character vector specifying whether all differentially expressed genes should be counted, or whether the counts should be restricted to genes changing in a certain direction. Choices are "both" for all differentially expressed genes, "up" for up-regulated genes only or "down" for down-regulated genes only. If include=c("up","down") then both the up and down counts will be shown. This argument is ignored if object if object is already a vennCounts object.
character vector giving names for the sets or contrasts
numeric vector of length 4 specifying the width of the margins around the plot. This argument is passed to par.
numerical vector of length 3 giving scaling factors for large, medium and small text on the plot.
numerical value giving the amount by which the circles should be scaled on the plot. See par.
vector of colors for the circles. See par for possible values.
vector of colors for the counts. Of same length as include. See par for possible values.
logical value whether the value of include should be printed on the plot. Defaults to FALSE if include is a single value and TRUE otherwise
any other arguments are passed to plot


vennCounts produces an object of class "VennCounts". This contains only one slot, which is numerical matrix with 2^ncol{x} rows and ncol(x)+1 columns. Each row corresponds to a particular combination of set memberships. The first ncol{x} columns of output contain 1 or 0 indicating membership or not in each set. The last column called "Counts" gives the number of rows of x corresponding to that combination of memberships.vennDiagram produces no output but causes a plot to be produced on the current graphical device.


Each column of x corresponds to a contrast or set, and the entries of x indicate membership of each row in each set or alternatively the significance of each row for each contrast. In the latter case, the entries can be negative as well as positive to indicate the direction of change.

vennCounts can collate intersection counts for any number of sets. vennDiagram can plot up to five sets.

See Also

An overview of linear model functions in limma is given by 06.LinearModels.


Run this code
Y <- matrix(rnorm(100*6),100,6)
Y[1:10,3:4] <- Y[1:10,3:4]+3
Y[1:20,5:6] <- Y[1:20,5:6]+3
design <- cbind(1,c(0,0,1,1,0,0),c(0,0,0,0,1,1))
fit <- eBayes(lmFit(Y,design))
results <- decideTests(fit)
a <- vennCounts(results)
mfrow.old <- par()$mfrow
    include=c("up", "down"),
    counts.col=c("red", "blue"),
    circle.col = c("red", "blue", "green3"))

Run the code above in your browser using DataCamp Workspace