
The labels parameter is a three-element vector for the labels that will appear at the top, left, and right corners. The first argument is the data set as a matrix or data frame. The ternaryPlot() function is always the starting point for making a ternary plot. Note that the call to percentages() isn’t necessary, since the rows already sum to 100%. Here is how an example data set might be set up. If your data do not, call percentages() to recalculate the percentages so that they do. The rows will correspond to individual samples.Įach row must sum to 100% to be plotted on a ternary diagram. For example, sandstones are commonly plotted with quartz at the top, feldspar at the left, and lithics on the right, so the three columns would be (in order), quartz, feldspar, and lithics. In both cases, the three elements or columns correspond to what will be plotted at the top, left, and right corners. Most of the functions in ternary.r expect either a 3-column data frame or matrix, or a 3-element vector. One is available through the vcd package, but it offers limited customization, so I’ve developed my own set of ternary diagram functions, available here. R does not come with a built-in ternary diagram function. These proportions of these three main components (quartz, feldspar, lithics) can be recalculated such that they sum to 100% and then plotted on a ternary diagram. For example, sandstones are commonly composed of quartz, two main types of feldspar, and various types of rock fragments called lithics, as well as other types of grains. Ternary diagrams are widely used in geology and other sciences to portray the proportions of three items that are constrained to sum to 100%.
