*! version 1.0 10july2013

Title

ternary -- Ternary (triangular) plots

Syntax

ternary
varlist
[, options]

where varlist is

leftvar rightvar topvar

options

style(graphtype) scatter or connected; default is scatter

labels(varname) specify observation labels

labelsize(textsizestyle) size of label; default is labelsize(medsmall)

by(varname) specify groups of observations (maximum is 6 groups)

grid(#) specify grid interval with interval equal to 1/#; default is grid(3) (i.e. thirds)

legendposition(clockposstyle) specify position of legend; default is legendposition(10)

legendsize(textsizestyle) size of legend text; default is legendsize(medsmall)

axislabelsize(textsizestyle) size of axis label text; default is axislabelsize(medsmall)

axistitlesize(textsizestyle) size of axis title text; default is axistitlesize(medsmall)

markersymbols(symbolstyle) specify symbols (maximum is 6 symbols); default is markersymbols(O O O O O O)

markercolors(colorstyle) specify colours for plots (maximum is 6 colors)

outer include outer reference area at a distance of -1/#

Description

ternary produces a ternary (or triangular) plot of three variables. The three
variables - relating to the bottom left, bottom right and top vertices of the triangle
- must sum to 1 (if the variables represent proportions) or 100 (if the variables
represent percentages).

Importantly, individual variables may be negative or may exceed 1 (or 100), as long
as the joint constraint is satisfied.

Options

style(graphtype) specifies the type of plot that is to be produced.
Either scatter or connected can be specified, although if this option
is not specified, the former is used by default.

labels(varname) specifies the variable that contains the labels for
each observation to be plotted. The variable can be numeric, labelled numeric, or
string. If not specified, the observations will not be labelled. To suppress labelling
for one or more observations, create a value label that is blank (" ") for values
corresponding to observations that should not be labelled.

labelsize(textsizestyle) specifies the size of the text for labelling
observations. The default size is medsmall.

by(varname) allows differentiating different groups of observations
within the ternary plot. These groups are designated by values contained in
varname. The number of groups is limited to a maximum of 6. varname
must be numeric. If varname is labelled, attached labels will
be used in the legend (otherwise, the numeric value will be used).

grid(#) allows specification of alternate grid intervals, with intervals
equal to 1/#. The default is grid(3), which divides the 'axes' into thirds.
Allowable values are: 1 (no grid); 2 (halves); 3 (thirds); 4 (quarters); 5 (fifths).

legendposition(clockposstyle) determines the location of the legend
within the plotregion. Default is legendposition(10).

legendsize(textsizestyle), axislabelsize(textsizestyle) and
axistitlesize(textsizestyle) specify the text sizes for axis labels (corresponding
to the grids) and axis titles respectively. Axis titles are derived from the variable
labels for leftvar, rightvar and topvar.

markersymbols(symbolstyle) specifies the symbols to be used in the
plot. A single symbol can be specified, or up to six symbols corresponding to the
six groups defined in by(varname) may be specified. The default
symbol is circle. Should the number of groups exceed the number of symbols
specified, the remaining groups will default to circle.

markercolors(colorstyle) specifies the colors to be used in the plot.
As is the case with markersymbols(), a single color or up to six colors corresponding
to the six groups may be specified. When colors are not specified, the default colors
from the default scheme are used.

outer specifies that an outer reference area be included in the plot.
This reference area is located at a distance of -1/# from the edges of the ternary
plot.

Examples

. ternary primary secondary tertiary

. ternary primary secondary tertiary, style(connected) grid(4)

. ternary primary secondary tertiary, style(scatter) labels(country) labelsize(small) by(region) grid(4) legendposition(7) axislabelsize(small) axistitlesize(medium) markersymbols(O D T S +) markercolors(red blue green yellow black)

Author

Morne Oosthuizen
Development Policy Research Unit, University of Cape Town
South Africa
morne.oosthuizen@uct.ac.za

All comments and suggestions are welcome.