jarterew.blogg.se

Ternary diagram excel
Ternary diagram excel








Last, all of the calls to ternaryPoints() are made to place the points on top of the plot. First, ternaryPlot() is called with plotPoints=FALSE, followed by all the calls to ternaryPolygon(). The color and border of the polygon can be customized by passing the additional arguments that polygon() would accept.īecause shaded polygons will cover over any points, it is important to plot the points after the polygons are added. The first and last vertices should be the same point so that the polygon is closed. Polygons can be added with ternaryPolygon(), which accepts a matrix of the vertices of the polygon, in either clockwise or counterclockwise order. To prevent this, call ternaryPlot() with plotPoints=FALSE, then ternarySegment(), then ternaryPoints(), as shown in the following example for a polygon. Note that, because the line was added after the points in this example, it covers them. TernarySegment(end0, end1, col='red', lwd=2) Some rock classifications divide the ternary diagram into areas, and ternarySegment() can be used to show those divisions. Additional graphical parameters like lty, lwd, and col can be supplied to customize the segment. Line segments can be added to the plot with the ternarySegment() function, which takes two arguments, the starting point and end point of the line segment. TernaryPlot(x, labels=c('Qm', 'F', 'Lt'), increment=10, plotPoints=FALSE) As with ternaryPlot(), additional parameters like pch and col can be passed to control the appearance of the plotted points.

#Ternary diagram excel series#

To add points manually, either all at once or in series that have custom characters or colors, use the ternaryPoints() function for each set of data to be added. For custom plots with added line segments and polygons, the display of points can be turned off by setting plotPoints=FALSE. Additional arguments like pch and col can be specified to control the color and type of points to be plotted. The light gray grid can be turned off by setting grid=FALSE, and the spacing of the grid lines can be set by changing the increment argument, which is the spacing of the grid lines in percentage points. 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%.








Ternary diagram excel