help ternaryternary v1.1 (GitHub)

ternary

: A Stata package for tri-variate plots.

Syntax

ternary varL varR varB [if] [in],
[ cuts(num) zoom normalize(1|100) fill points lines labels colorL(str) colorR(str) colorB(str)
lwidth(str) msymbol(str) msize(str) mcolor(str) mlcolor(str) mlwidth(str) labcolor(str) ticksize(str)
mlabel(var) mlabsize(str) mlabcolor(str) mlabposition(str)
*
]

The options are described as follows:

ternary varL varR varB The order of the variables is Left, Right and Bottom.

cuts(num) Total number of evenly-spaced segments in the triangle. Default is cuts(5).

zoom Zoom into the data based on the data min/max extents. Use this option if the data points are clustered in a part of the triangle.

normalize(1|100) Normalize the data on a 1 (norm(1)) or a 100 (norm(100)) scale using the row totals of the varlist.
If this is not specified, the program will auto-detect the normalization level.

Colors

fill Add graduated colors to the triangles. See below for color options.

points Add graduated colors to the points defined by the triangle they are in. Note that while both fill and points can be simultanously used,
but it will create a hollow marker illusion where only marker outlines are visible. So avoid this. Broadly, just using points renders faster since not all triangles contain points.
Point markers and outcomes can also be customized. See below.

lines Add line colors in the triangle.

labels Add colors to axes labels and ticks.

colorL(str), colorR(str), colorB(str) User either a named color recognized by colorpalette or use a hex code.
Defaults are colorL(#00E0DF), colorR(#FF6CFF), and colorB(#DCB600). These colors represent the maximum values for each axes.
The convex combinations of all the in-between colors are auto generated. Please note that the number of triangles = cuts^2, hence the program slows down exponentially (O(n)=n^2 complexity).
So avoid going over 10 cuts which in any case renders the information meaningless as colors become indistinguishable. Here lower numbers are better.

Markers and triangle grids

lwidth(str) Line width. Default is lwidth(0.15).

lcolor(str) Line color. Default is lcolor(gs8). If fill is used then it defaults to lc(white).

labcolor(str) Label color. Default is lcolor(black). Also affects tick colors.

ticksize(str) Axes tick size. Default is ticks(1).

msymbol(str) Marker symbol. Default is msym(circle).

msize(str) Marker size. Default is msize(1.5).

malpha(str) Marker fill intensity if the options points is used. Default is malpha(90) or 90% fill. For simple points use for example mcolor(%50).

mcolor(str) Marker color if the option points is not specified. Default is mcolor(black).

mlcolor(str) Marker outline color. Default is mlcolor(white).

mlwidth(str) Marker outline width. Default is mlwidth(0.1).

Marker labels

mlabel(var) Define the label variable.

mlabsize(str) Size of marker labels.

mlabcolor(str) Color of marker labels.

mlabposition(str) Position of marker labels.

* All other twoway options not elsewhere specified.

Dependencies

The following packages are required for ternary:

ssc install palettes, replace
ssc install colrspace, replace
ssc install moremata, replace

Even if you have these installed, it is highly recommended to check for updates: ado update, update

Examples

See GitHub.

Package details

Version : ternary v1.1
This release : 12 Sep 2024
First release: 28 Aug 2024
Repository : GitHub
Keywords : Stata, graph, ternary, triplot
License : MIT

Author : Asjad Naqvi
E-mail : asjadnaqvi@gmail.com
Twitter/X : @AsjadNaqvi

Feedback

Please submit bugs, errors, feature requests on GitHub by opening a new issue.

Acknowledgements

Nick Cox's triplot (Cox 2009) provided the inspiration for this package.

Citation guidelines

Suggested citation guidlines for this package:

Naqvi, A. (2024). Stata package "ternary" version 1.1. Release date 12 September 2024. https://github.com/asjadnaqvi/stata-ternary.

@software

References

Cox, N. (2009). Triplot: Stata module to generate triangular plots.

Jann, B. (2018). Color palettes for Stata graphics. The Stata Journal 18(4): 765-785.

Jann, B. (2022). Color palettes for Stata graphics: An update. University of Bern Social Sciences Working Papers No. 43.

Other visualization packages

arcplot, alluvial, bimap, bumparea, bumpline, circlebar, circlepack, clipgeo, delaunay, joyplot,
marimekko, polarspike, sankey, schemepack, spider, splinefit, streamplot, sunburst, ternary, treecluster, treemap, trimap, waffle