The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
gplots
Venn diagrams Wikipedia allow for a quick overview on the number of elements that multiple sets share. When those elements represent traits of real objects, like observations in biomedical sciences, marketing, etc., this may direct researchers to further investigations or decisions.
The gplots
package provides Venn diagrams for up to five
sets. The R code to produce the diagrams is straightforward. The plot
function behaves the same, depending only on the number of overlapping
circles to draw. Its input is a table that is produced by another
function. The venn()
function calls one after the other and
is the only one to be seen by the user. The values shown are returned
invisibly.
The venn()
function accepts either a list of sets as an
argument, or it takes a binary matrix—one column per set—indicating for
every element, one per row, the membership with every set.
The common form with overlapping circles works with up to three sets, as seen here:
The names of columns or the list elements are the set names. To squeeze extra circles in, those circles need to become ellipses. This works for four sets:
## num A B C D
## 0000 0 0 0 0 0
## 0001 3 0 0 0 1
## 0010 0 0 0 1 0
## 0011 3 0 0 1 1
## 0100 0 0 1 0 0
## 0101 1 0 1 0 1
## 0110 0 0 1 1 0
## 0111 0 0 1 1 1
## 1000 3 1 0 0 0
## 1001 0 1 0 0 1
## 1010 0 1 0 1 0
## 1011 0 1 0 1 1
## 1100 0 1 1 0 0
## 1101 1 1 1 0 1
## 1110 0 1 1 1 0
## 1111 1 1 1 1 1
## attr(,"intersections")
## attr(,"intersections")$A
## [1] "1" "2" "3"
##
## attr(,"intersections")$D
## [1] "7" "11" "12"
##
## attr(,"intersections")$`B:D`
## [1] "6"
##
## attr(,"intersections")$`C:D`
## [1] "8" "9" "10"
##
## attr(,"intersections")$`A:B:D`
## [1] "5"
##
## attr(,"intersections")$`A:B:C:D`
## [1] "4"
##
## attr(,"class")
## [1] "venn"
And maybe even more impressively for five:
The man page of venn() lists options to change the appearance of the plots, e.g., the names of the sets may be omitted, and sizes changed. However, there is ample opportunity to extend the functionality of this package, such as:
The prime personal interest is in the increase of dimensions. Please send patches for features you are most interested in.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.