-------------------------------------------------------------------------------
help for triplot
-------------------------------------------------------------------------------

Triangular plot

triplot leftvar rightvar botvar [if exp] [in range]

[ , max(#) separate(varname) by(byvar [, by_options])

label(numlist) grid(grid_options)

vertices(#) frame(frame_options)

y y(y_options)

centre(#left #right #bottom)

ltext(string) rtext(string) btext(string) bltext(string) ttext(string) brtext(string) text(text_options)

scatter_options ]

Description

triplot produces a triangular plot of the three variables leftvar, rightvar and botvar, which are plotted on the left, right and bottom sides of an equilateral triangle. Each should have values between 0 and some maximum value (default 1) and the sum of the three variables should be equal to that maximum (within rounding error). Most commonly, three fractions or proportions add to 1, or three percents add to 100.

The constraint that the three variables have a constant sum means that there are just two independent pieces of information. Hence it is possible to plot observations in two dimensions within a triangle, which is a 2-simplex.

Triangular plots appear under various names in the literature, including tripolar, trinomial, trilinear, triaxial, three-element maps, ternary, simplex, reference triangles, percentage triangles, mixture, barycentric. Common geological applications are to sedimentary facies or particle form: hence more specific terms such as facies and form triangles. In genetics, applications are often called de Finetti diagrams.

Remarks

The author recommends the s1color scheme for defaults congenial with these plots.

Options

max() indicates the upper limit of each variable, and the sum of all three variables. Default value is 1. max(100) indicates percents.

separate() indicates that observations are to be subdivided into classes according to a specified variable. A legend will be shown if and only if more than one class is so defined. Each class is plotted as if it defined a single variable. Thus if separate() subdivides into two classes, and you want points for each class to be connected and have different marker colours of your choice, specify also options such as c(l l) mcolor(pink blue).

by() specifies that plots are to be shown separately according to the categories of a specified variable.

label() specifies a list of numeric labels to be shown on each side of the triangle, which imply a grid of reference lines within the triangle. The default is 0(0.2)1, or 0(20)100 if max(100) is specified, or 0(200)1000 if max(1000) is specified. As a special case, label(nolabels) specifies no labels and no reference lines.

grid() specifies options controlling the rendering of the labels and grid lines. Know that twoway connected is used for rendering and that the labels are shown as marker labels: hence use connect options or marker label options to make changes from the default. Example: grid(lpat(shortdash)) changes the line pattern to shortdash.

vertices() specifies that only the vertices should be shown and not the complete triangular frame. The argument is the fraction of each side that is shown. vertices(0.1) means that 0.1 or 10% of each side will be shown.

frame() specifies options controlling the rendering of the triangular frame. Know that line is used for rendering: hence use connect options to make changes from the default. Example: frame(lpat(dot)) changes the line pattern to dot.

y specifies that the Y is to be drawn that divides the triangle into regions in which each variable is greater than the other two. Some political scientists call the spokes of the Y 'win lines'. Unless centre() is specified, each spoke connects the midpoint of each side to the centroid of the triangle (which, by virtue of symmetry, is also the incentre, the circumcentre, the orthocentre and the Fermat point of the triangle).

y() specifies options controlling the rendering of the Y. Know that line is used for rendering: hence use connect options to make changes from the default. Example: y(lcolor(green)) changes the line colour to green.

centre() specifies three numbers to be used as centre for the triangle, referring in order to left, right and bottom variables. Suppose three percent variables p, q, r are being shown, and three numbers P, Q and R are specified as centre, with sum 100. Then data are transformed to

(p/P) / (p/P + q/Q + r/R) (q/Q) / (p/P + q/Q + r/R) (r/R) / (p/P + q/Q + r/R)

Vertices remain vertices and contours of p, q, r remain straight. See Upton (2001).

As a convenience to users who do not use standard English spelling, the synonym center() is also allowed.

ltext(), rtext() and btext() control text on the left, right and bottom sides of the plot. They default to the variable labels (or if those do not exist, the names) of leftvar, rightvar and botvar. In each case, specifying " " blanks out the text.

bltext(), ttext(), brtext() control text by the bottom left, top and bottom right vertices of the triangle. These options are intended as an alternative to numeric labels at the vertices.

text() specifies options controlling the rendering of the text specified by the *text() options. Know that scatter is used for rendering the text as marker labels: hence use marker label options to make changes from the default. Example: text(mlabsize(medium)) changes the label text size pattern to medium.

scatter_options are options of scatter.

Examples

. triplot services industry agriculture, max(100) title("Structure of GDP 1996: 112 economies")

. triplot services industry agriculture, max(100) title("Structure of GDP 1996: 112 economies") vert(0.2) la(nolabels) y ttext(services) bltext(agriculture) brtext(industry) ltext(" ") rtext(" ") btext(" ")

. triplot Dem Rep other, separate(region)

Author

Nicholas J. Cox, Durham University, U.K. n.j.cox@durham.ac.uk

Acknowledgments

Friedrich Huebler pointed to some bugs and posed some useful questions. Scott Merryman and Thomas Steichen found other bugs. Vince Wiggins provided encouragement.

References

Cox, N.J. 2004. Graphing categorical and compositional data. Stata Journal 4: 190-215. http://www.stata-journal.com/article.html?article=gr0004

Gray, J. 1993. Möbius's geometrical mechanics. In Fauvel, J., R. Flood and R. Wilson (eds) Möbius and his band: mathematics and astronomy in nineteenth-century Germany. Oxford: Oxford University Press, pp.79-103.

Möbius, August Ferdinand. 1827. Der barycentrische Calcul: ein neues Hülfsmittel zur analytischen Behandlung der Geometrie dargestellt und insbesondere auf die Bildung neuer Classen von Aufgaben und die Entwicklung mehrerer Eigenschaften der Kegelschnitte. Leipzig: Johann Ambrosius Barth. [1790-1868]

Upton, G.J.G. 2001. A toroidal scatter diagram for ternary variables. The American Statistician 55: 247-250.