Almost all graphical options in the *VennDiagram *package have been parameterized and made customizable. Default values were selected to generate sensible diagrams, so in simple cases a high level of customization is not required. Figure highlights the diversity of parameterizations available. Four major graphical parameter groups exist: shape-fill, shape-line, labels and titles. Shape-fill refers to the colours within each circle or ellipse. All colours available in the R environment can be used, and alpha-blending can be adjusted on a per-shape basis. Shape-lines are the lines that surround each circle or ellipse. They can be entirely absent (figure ), solid (figures and ), or any other R line-type available (figure ). Their colour can be changed, and each shape can have a separate set of parameters. Labels refer both to the captions describing each circle or ellipse and to the numbers within them. Again, these can be customized in terms of colour, font-type, and font-size with any available R parameter. The positions of caption labels can also be customized. Titles, which include the main title and the subtitle as demonstrated in figure , can also be customized in the same way as labels.

Beyond these specific graphic elements,

*VennDiagram *also offers many general options, such as the scaling, rotation, or inversion of diagrams. Diagram scaling was implemented with the goal of displaying Venn diagrams where the graphical sizes of the partial areas (areas bound on all sides by curves and that cannot be further subdivided) actually correspond to the numerical values of the number of elements within each region. Scaling of two-set Venn diagrams and a select number of three-set Venn diagrams is possible - we discuss below the challenges of making this possible for all three-set cases. The use of scaling can sometimes lead to overlapping areas being too small for numeric labels. Figure , row 1, column 1 shows a programmatically generated connecting line that allows special handling of this case. Automatic recognition of a large number of Euler diagrams is implemented, but this mode can be deactivated with a function-call parameter to plot standard Venn diagrams instead. Figure , row 1, columns 2 and 3 show two examples of two-set Euler diagrams. Rows 2 and 3 show a subset of implemented three-set Euler diagrams with row 3 showing those of the scalable variety. We note that figure is presented in black and white to highlight compositional differences across diagrams, but the graphical parameters and customizations used in figure are fully available. While VennDiagram defaults to writing graphics to high-resolution TIFF files, if the filename parameter is set to NULL the raw grid object can be returned and used in any graphics mode available in R. The code to generate all figures is given in Additional File

3 and an example of all available parameterizations is shown in Additional File

4.

Discussion

During development of the

*VennDiagram *package, it was discovered that it was impossible to draw accurate, scaled Venn diagrams with three sets using circles. This conundrum is illustrated in the following scenario. In a system of two circles A and B, the distances between the centres of the circles, d

_{AB}, could be determined as long as the areas (A

_{A }and A

_{B }respectively) and the intersection area (A

_{A }∩ A

_{B}) are both known. This is possible because in a two-circle system a single A

_{A }∩ A

_{B }corresponds to a unique value for d

_{AB}. Therefore, a system of three circles A, B, and C, d

_{AB}, d

_{BC}, d

_{AC }could be calculated as long as A

_{A}, A

_{B}, A

_{C}, A

_{A }∩ A

_{B}, A

_{A }∩ A

_{C}, A

_{B }∩ A

_{C }are all known. However, d

_{AB}, d

_{BC}, d

_{AC }make a unique triangle, implying that a Venn diagram can be drawn without ever knowing the overall intersection A

_{A }∩ A

_{B }∩ A

_{C}. In other words, the size of the overlap between all three circles does not alter the presentation of scaled Venn diagrams -- the area is unchanged even if one system has zero overall intersection (i.e. A

_{A }∩ A

_{B }∩ A

_{C }= 0)! This conundrum results from the (arbitrary) choice of circles to represent set size, which reduces the degrees of freedom by one. Unique solutions can be identified by using ellipses or polygons to draw Venn diagrams but the resulting diagrams would lose the instant recognisability and familiarity associated with circular Venn diagrams, defeating the point of a convenient display of information. Non-circular diagrams would also require iterative algorithms to compute the positions and sizes of the shapes, greatly increasing computational burdens, as has been discussed by others [

10]. Consequently, scaling of three-set Venn diagrams is disabled in the

*VennDiagram *package. Similarly, Venn diagrams containing more than four sets [

11,

12] were not implemented in the

*VennDiagram *package because they become too complex for intuitive visualization.

A general caveat when using Euler diagrams is that although they reduce the graphical complexity of some Venn diagrams, their non-traditional shapes may also be less recognizable in some cases. When empty areas are present, the user needs to choose between the familiarity of Venn diagrams and the increased accuracy of Euler diagrams. Figure illustrates a situation where either a Venn or an Euler diagram may be appropriate depending on user preferences.

The *VennDiagram *package handles all two-set Euler diagrams and the majority of all conceivable three-set Euler diagrams. Three-set Euler diagrams that could not be drawn using circles or ellipses are not supported. For example, an Euler diagram for the case where two non-intersecting sets comprise the third set cannot be drawn using circles and ellipses, though it may be drawn using polygons. This type of figure lacks a ready analytical layout and would require iterative fitting; no polygon-requiring Euler diagrams are available, but standard Venn diagrams are available for these few unsupported cases.

After comparing with other programs capable of generating Venn diagrams (Table ), advantages of the *VennDiagram *package include:

| **Table 1**A comparison of the features of various programs capable of generating Venn diagrams. |

• Drawing Euler diagrams using circles and/or ellipses with two or three sets

• Offering greater customizability to generate more elegant diagrams

• Availability in the widely-used R statistical environment

• Generating high resolution TIFF files that are standard in publications