help pvenn

Title

Proportional Venn Diagrams

Syntax

pvenn [var1 [... var3]]
[, [manual_mode_opts] options]

manual_mode_opts

Main
plabel(lblname [lblname ...]) specifies a list of label names for the populations.

pA(#) specifies the size of population A.

pB(#) specifies the size of population B.

pC(#) specifies the size of population C.

pAB(#) specifies the size of overlap between population A & B.

pAC(#) specifies the size of overlap between population A & C.

pBC(#) specifies the size of overlap between population B & C.

ptotal(#) specifies the size of total population.

Main
ang(#) specifies the angle between the connecting lines of circle A/B center and the X axis, that is the relative location of circle B to circle A; default is 0.

pos(#) specifies the relative location of circle C to circle A & B; default is 1.

drawtotal(#) draw a rectangle outside all circles to represent the total population size; default is 1.

drawlabel(#) draw labels in circles indicating names of the populations; default is 1.

lc(colorstylelist) specifies a line color for each circle and rectangle; default is "cranberry emerald brown lavender".

lp(linepatternstylelist) specifies a line pattern for each circle and rectangle; default is "solid solid solid solid".

lw(linewidthstylelist) specifies a line widths for each circle and rectangle; default is "0.8 0.8 0.8 0.8".

n(#) specify the points (#*2) used to draw a circle; default is 20000.

twoway_options specifies additional twoway options (not all of them area allowed), for example titles() and notes().

Description

pvenn produces proportioned and positioned Venn diagrams,
supporting 2-circle and 3-circle Venn diagrams, as well as 1-circle diagram. pvenn can also draw a rectangle
outside all circles to proportionally represent the total population size, when it is possible.
Proportional Venn diagrams attempts to make each of the zones (the circles, the outside rectangle, and the set intersections) proportional
to the population (value) assigned to the zone. Note that, the overlap regions
of 3-circle Venn diagrams are not always to scale, because an
ideal solution is generally not possible using circles.

There are two ways to use pvenn:

1. Generating Venn diagrams from dataset: pvenn can draw Venn diagrams from one, two, or three variables.
The variables must only have value of 0 and 1, where 1 means positive observation and 0 means negative observation.
With one variable specified, a 1-circle diagram will be created to show the size of positive observations, and if drawtotal(1) is specified,
an outside rectangle would be drawn to propotionally represent the relative size of total population to the size of positive ones.
With two or three variables specified, 2-circle or 3-circle proportional Venn diagrams can be created. For example in the dataset below,

. list popA popB popC
+-----------------------+
| popA popB popC |
|-----------------------|
1. | 1 0 0 |
2. | 1 1 1 |
3. | 0 1 1 |
4. | 0 0 0 |
5. | 1 0 1 |
+-----------------------+

Observation 1 belongs to population A but not population B or C;

Observation 5 belongs to population A and C but not population B;

total population = 5;

population A = 3;

population B = 2;

population C = 3;

overlap population A/B = 1;

overlap population A/C = 2;

overlap population B/C = 2;

Observations with missing values are dropped.

2. Generating Venn diagrams from manual inputs: When no variable is specified, pvenn can draw Venn diagrams using manual_mode_opts.
In the above example,

. pvenn popA popB popC

is equivalent to

. pvenn, plabel(popA popB popC) pA(3) pB(2) pC(3) pAB(1) pAC(2) pBC(2) ptotal(5)

Options Generating Venn diagrams from manual inputs

Main

The manual_mode_opts options are functional only when no variable is specified.

plabel(lblname [lblname ...]) specifies a list of label names for the populations. Minimum 1 and maximum 3 labelnames should be specified.

pA(#) specifies the size of population A; default is 0. If pA(0), circle A is not drawn.

pB(#) specifies the size of population B; default is 0. If pB(0), circle B is not drawn.

pC(#) specifies the size of population C; default is 0. If pC(0), circle C is not drawn.

pAB(#) specifies the size of overlap between population A & B; default is 0.

pAC(#) specifies the size of overlap between population A & C; default is 0.

pBC(#) specifies the size of overlap between population B & C; default is 0.

ptotal(#) specifies the size of total population; default is 0. If ptotal(0) is specified, outside rectangle is not drawn.

Options

Main

ang(#) specifies the angle between the connecting lines of circle A/B center and the X axis, that is the relative location of circle B to circle A; default is 0.

pos(#) specifies the relative location of circle C to circle A & B; default is 1.
pos(1) circle C is drawn clockwise to the circle A & B; pos(-1) circle C is drawn counterclockwise to the circle A & B.

lc(colorstylelist) specifies a line color for each circle and rectangle; default is "cranberry emerald brown lavender".
The sequence is circleA, circleB, circleC, and outside rectangle. Use . to skip an item in the list.

lp(linepatternstylelist) specifies a line pattern for each circle and rectangle; default is "solid solid solid solid".
The sequence is circleA, circleB, circleC, and outside rectangle. Use . to skip an item in the list.

lw(linewidthstylelist) specifies a line widths for each circle and rectangle; default is "0.8 0.8 0.8 0.8".
The sequence is circleA, circleB, circleC, and outside rectangle. Use . to skip an item in the list.

drawtotal(1) draw a rectangle outside all circles to represent the total population size; default is 1. drawtotal(0) suppress the draw.

drawlabel(1) draw labels in circles indicating names of the populations; default is 1. drawlabel(0) suppress the display of labels.

n(#) specify the points (#*2) used to draw a circle; default is 20000. Refer to help twoway_function.

twoway_options specifies additional twoway options (not all of them area allowed), for example titles() and notes().

Examples

1. Generating Venn diagrams from dataset:

The examples below highlight the use of the pvenn plot on the nlsw88 dataset, which is pre-installed with Stata software.

Click below to load dataset

sysuse nlsw88

Click below (after the dataset is loaded) to see the intersections among "never married" "college graduate" and "lives in south".

pvenn never_married collgrad south

pvenn never_married collgrad south, ang(30) drawtotal(0) pos(-1)

pvenn never_married collgrad south, drawtotal(1) lc("black" "red") lw(0.1 0.3 0.5 0.8) lp("_" "." "dash_dot" "-")

Click below to see the intersections among "married" "lives in south" and "lives in central city".

pvenn married south c_city

In this case, total population cannot be represented as an outside rectangle.

2. Generating Venn diagrams from manual inputs:

1-circle diagram:

pvenn, pA(10) pB(0) pC(0) pAB(0) pAC(0) pBC(0) ang(30) ptotal (30) drawtotal(1) pos(-1) plabel("Max" "Jan" "Winston")

2-circle Venn diagram:

pvenn, pA(10) pB(0) pC(30) pAB(0) pAC(3) pBC(0) ang(30) drawtotal(1) pos(-1) plabel("Max" "Jan" "Winston")

pvenn, pA(10) pB(30) pC(0) pAB(0) pAC(0) pBC(3) ang(30) drawtotal(1) pos(-1) plabel("Max" "Jan" "Winston")

3-circle Venn diagram:

pvenn, pA(10) pB(30) pC(20) pAB(4) pAC(5) pBC(3) ang(30) ptotal(90) drawtotal(0) pos(1) plabel("Max" "Jan" "Winston") title(Example)

pvenn, pA(45) pB(25) pC(50) pAB(18) pAC(5) pBC(3) ang(120) drawtotal(1) pos(-1) drawlabel(0) plabel("Max" "Jan" "Winston") title(Example)

pvenn, pA(10) pB(30) pC(20) pAB(0) pAC(0) pBC(3) ang(30) drawtotal(1) pos(-1) plabel("Max" "Jan" "Winston") title(Example)

Authors

Wenfeng (Winston) Gong & Jan Osterman;

Center for Health Policy and Inequity Research at Duke University, Durham, NC.

Email gongwenf@gmail.com