help trimaptrimap v1.1 (GitHub)

ternary

: A Stata package for tri-variate maps.

The command is a wrapper for geoplot and ternary.
All ternary customization options can be used to generate the legend.

Syntax

trimap varL varR varB [if] [in],
[ frame(frame name) cuts(num) normalize(1|100) geo(layers) geopost(options)
zoom fill points lines labels colorL(str) colorR(str) colorB(str)
lwidth(str) msize(str) malpha(num) mcolor(str) mlcolor(str) mlwidth(str)
leglwidth(str) leglcolor(str) mlabel(var) mlabsize(str) mlabcolor(str) mlabposition(str)
xscale(num) yscale(num) *
]

The options are described as follows:

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

frame(str) Define the frame in which the primary data exists. If no option is specified, then the current active frame is used.

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.

lcolor(str) Line color of map area outline. Default is lcolor(white).

lwidth(str) Line width of map area outline. Default is lwidth(0.05).

geo(layers) Define additional spatial layers that are passed on to the geoplot command.

geopost(options) Define the post comma options in geoplot such as compass, scalebar, zooms, etc.

Colors

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

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 points where value is 1 or 100 for each layer.
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.
as O(n)=n^2. So avoid going over 10 cuts which in any case renders the information meaningless as colors become indistinguishable. Here lower numbers are better.

Legend markers and lines

leglcolor(str) Legend line color. Default is leglcolor(gs8).

leglwidth(str) Legend line width. Default is leglwidth(0.15).

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).

Legend 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.

xscale(num) Scale of the legend x-axis (width). The default if xscale(50). Increasing or decreasing this number will shrink or enlarge the legend respectively.

yscale(num) Scale of the legend y-axis (height). The default if yscale(100). Increasing or decreasing this number will shrink or enlarge the legend respectively.
Ideally do not use this option and modify xscale() if required.

* All other twoway options not elsewhere specified.

Dependencies

The following packages are required for trimap:

ssc install ternary, replace
ssc install geoplot, replace
ssc install moremata, replace
ssc install palettes, replace
ssc install colrspace, replace

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

Examples

See GitHub.

Package details

Version : trimap v1.1
This release : 12 Sep 2024
First release: 28 Aug 2024
Repository : GitHub
Keywords : Stata, graph, ternary, triplot, trimap, tri-variate map
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.

Citation guidelines

Suggested citation guidlines for this package:

Naqvi, A. (2024). Stata package "ternary" version 1.0. Release date 28 August 2024. https://github.com/asjadnaqvi/stata-trimap.

@software

References

Jann, B. (2005). moremata: Stata module (Mata) to provide various functions. Available from https://ideas.repec.org/c/boc/bocode/s455001.html.

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.

Jann, B. (2023). geoplot: Stata module to draw maps. Available from https://ideas.repec.org/c/boc/bocode/s459211.html.

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