Description Usage Arguments Details Value Author(s) See Also
VennPlot draws a Venn diagram based on the overlap of three sets, where the area are proportional to the size of each set an the overlaps approximate the relative overlap to the extent possible.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
set1 |
Either a vector of identifiers (may be numeric or text) to define a single set, or a list of two or three such vectors. If set is a list, the names of the elements will be used as the names if the labels argument (below) is not supplied. Also, if set1 is a list, all remaining arguments must be named. Only the unique values in each set will be counted (replicate values will be removed). |
set2, set3 |
Vectors of identifiers; may be numeric or text. If set1 is a vector, set2 is required and set3 is optional. If set1 is a list, the set2 and set3 arguments will be ignored if supplied. |
labels |
Optional character vector with names of each set. |
lwd |
A number specifying line width of the circles. |
cex.text |
A number specifying character size for labels. |
col |
A character vector of named colors for each set; length should be equal to the number of sets. |
mar |
4-element vector of positive numbers specifying outer margin of plot. |
main |
A character string specifying title of plot. |
cex.main |
A number specifying font size to use for title |
labels.at |
If NA (default), or any of the values are NA, the function will attempt to place the labels automatically. If omitted, the user will be prompted to manual select locations by clicking on the plot. Otherwise, a 2-row column matrix with x- and y- coordinates indicating
placement of the set labels. Number of rows must equal number of sets.
On subsequent calls, may be extracted from the "Circles" element of the
list returned by this function: |
xscale, yscale |
Numeric value that controls the range of the data shown. Default is 1.01; larger values will leave more space around the margins (sometimes useful for making labels fit), while smaller values could be used to remove extra space when the aspect ratio differs from one. |
return.sets |
Logical; if TRUE, return a data.frame with each unique item's assignment to an overlap region. |
Only the unique values in each set will be counted (replicate values will be removed). A plot will generated with overlapping circles approximating the overlap between the sets. (It is not always possible to accurately represent the overlap of three sets using circles.)
Labels for each set may be placed in one of three ways using the labels.at argument:
If labels.at is set to missing (NA; default), the function will place the labels automatically near the centers of each set.
If labels.at is set to NULL, the user will prompted to select locations for each label by clicking on the plot. This is useful for fine-tune label placement for legibility. Do not close the plot window before placing the labels or it will screw up you session! Do not use this option if plotting to a file (no interactive window).
You can also supply a data.frame with values specifying the location.
You can get the values for this data frame by running the function with
labels.at=NULL to manually place the labels; the list returned will
include these values: <list>$Circles[, c("x.label", "y.label")]
.
This can be useful if you want to be able to rerun a script where you
have already determined optimal placement manually.
Returns a list object with named elements:
Areas: data.frame specifying number of unique items in various regions of the Venn diagram and the midpoints of each region on the plot (i.e., where the labels are placed). Circles : data.frame with the centers (x and y) and radii of the circles for each set
M.W.Rowe, mwr.stats@gmail.com
par
and plot.default
give
more detailed descriptions of the plotting parameters lwd, cex.text, col
mar, main and cex.main.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.