The argument x
can be either:
- a single number (of sets), between 1 and 7
- a metacommand (character) to draw custom intersection zones
- a list, containing values for the different sets: each component is a set,
and only up to 7 components are processed.
- a dataset of boolean values.
A "zone" is a union of set intersections. There are exactly 2^k
intersections
in a Venn diagram, where k
is the number of sets. To highlight an entire set,
we need a union of all possible intersections which form that set.
For example, in a 3 sets diagram, the (overall) first set is composed by four
intersections:
100
for what is in the first set but outside sets 2 and outside set 3
101
for the intersection between sets 1 and 3, outside set 2
110
for the intersection between sets 1 and 2, outside set 3
111
for the intersection between all three sets.
A meta-language can be used to define these intersections, using the values of
1
for what is inside the set, 0
for what is outside the set, and
-
when its either inside or outside of the set.
The command "1--"
is translated as "display only the first, entire set" is
equivalent with the union of the four intersections "100 + 101 + 110 + 111"
.
The parameter snames
should have the same length as the number of sets
specified by the parameter x
.
When the parameter x
is used as a metacommand, the number of sets is calculated
as the number of characters in each intersection of the metacommand. One such
character command is "100 + 101 + 110 + 111"
or "1--"
, and all
intersections have exactly three characters.
It is also possible to use a regular, disjunctive normal form, like "A"
,
which is equivalent with "Abc + AbC + ABc + ABC"
. When x
is an expression written in DNF, if a valid R statement then quoting is not even necessary.
The argument snames
establishes names for the different sets, or in its absence
it is taken from LETTERS
. When x
is a list or a dataframe,
snames
is taken from their names. The length of the snames
indicates the total number of sets.
A numerical vector can be supplied with the argument counts
, when the argument
x
is a single number of sets. The counts should match the increasing order of
the binary representation for the set intersections. When the argument x
is a
list, the counts are taken from the number of common values for each intersection, and when
x
is a data frame, (comprised of exclusively boolean values 0 and 1) the counts
are taken from the number of similar rows. If a particular intersection does not have any
common values (or no rows), the count "0" is left blank and not displayed in the diagram.
The argument ellipse
differentiates between two types of diagrams for 4 and 5 sets.
The idea is to allow for as much space as possible for each intersection (also as equal
as possible) and that is impossible if preserving the shape of an ellipse. The default is
to create large space for the intersections, but users who prefer an ellipse might want
to set this argument to TRUE
.
Colors to fill the desired zones (or entire sets) can be supplied via the argument
zcolor
(the default is "bw"
black and white, which means no colors at all).
Users can either chose the predefined color style, using zcolor = "style"
, or supply
a vector of custom colors for each zone. If only one custom color is supplied, it will
be recycled for all zones.
When using zcolor = "style"
, any other additional arguments for the borders are
ignored.
A different set of predefined colors is used, when argument x
is a QCA type object
(a truth table, either from a class tt
or from a class qca
). If custom colors
are provided via zcolor
, it should have a length of 3 colors: the first for the
absence of the outcome (0
), the second for the presence of the outcome (1
),
and the third for the contradictions (C
). Remainders have no color, by default.
The argument ilcs
works only if the intersection labels (ilabels
) or
intersection counts
are activated, and it sets the size of the labels via a
cex
argument. In the absence of a specific value from the user, it's default is
set to 0.6 for all Venn diagrams with up to five sets, and it automatically decreases to 0.5
for six sets and 0.45 for seven sets.
Via ...
, users can specify additional parameters, mainly for the outer borders
of the sets, as specified by par()
, and since version 1.9 it is
also used to pass additional aesthetics parameters for the ggplot2 graphics. All of them are
feeded either to the base function lines()
which is responsible
with the borders, or to the function geom_path()
from package
ggplot2.
For up to 3 sets, the shapes can be circular. For more than 3 sets, the shape cannot be
circular: for 4 and 5 sets they can be ellipses, while for more than 5 sets the
shapes cannot be continous (they might be monotone, but not continous). The 7 sets
diagram is called "Adelaide" (Ruskey, 2005).
The most challenging diagram is the one with 6 sets, where for many years it was
thought a Venn diagram didn't even exist. All diagrams are symetric, except for the
one with 6 sets, where some of the sets have different shapes. The diagram in this
package is an adaptation from Mamakani, K., Myrvold W. and F. Ruskey (2011).
The argument border
can be used only for custom intersections and/or unions,
it has no effect when x
is a list, or a data frame, or a truth table object.
The argument par
is used to define a custom set of parameters when producing
the plot, to ensure a square shape of about 15 cm and eliminate the outer regions. If
deactivated, users can define their own size and shape of the plot using the system function
par()
. By default, the plot is always produced using a size of
1000 points for both horizontal and vertical, unless the argument ggplot
is
activated, when the argument par
will have no effect.