Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


ggtern (version 1.0.6.1)

stat_interpolate_tern: Ternary Interpolation

Description

This is the heavily requested statistic for interpolating between ternary values, results being rendered using contours on a ternary mesh

Usage

stat_interpolate_tern(mapping = NULL, data = NULL,
  geom = "InterpolateTern", position = "identity", na.rm = FALSE,
  n = getOption("tern.mesh.size"), buffer = getOption("tern.mesh.buffer"),
  formula = value ~ poly(x, y, degree = 2, raw = TRUE), method = "lm", ...)

Arguments

mapping
The aesthetic mapping, usually constructed with aes or aes_string. Only needs to be set at the layer level if you are overriding the plot defaults.
data
A layer specific dataset - only needed if you want to override the plot defaults.
geom
The geometric object to use display the data
position
The position adjustment to use for overlapping points on this layer
na.rm
If FALSE (the default), removes missing values with a warning. If TRUE silently removes missing values.
n
Number of grid points in each direction of the mesh. Can be scalar or a length-2 integer vector.
buffer
factor to buffer the mesh, to prevent ugly truncation of contours, 1.0 means no buffering
formula
formula to use in smoothing function, eg. y ~ x, y ~ poly(x, 2), y ~ log(x)
method
smoothing method (function) to use, eg. lm, glm, gam, link{loess} or rlm
...
other arguments passed on to the method argument above

Value

  • A data frame with additional column:
  • levelheight of contour

Model Formula

By default, the interpolation is done using multivariate linear regression using the following expression: formula=value~poly(x,y,degree=2), where value is the response (dependent) variable, and the independent predictor variables, x and y represent the variables matching to twp (2) out of the three (3) ternary axis definitions (T,L or R) as documented and defined within coord_tern.

Having said the above, the model formula can be changed to anything that suits the user by including method and/or formula arguments which get passed through to the model fitting and prediction components of the calculation routine.

Aesthetics

[results=rd,stage=build]{ggtern:::rd_aesthetics("stat", "InterpolateTern")} geom_interpolate_tern, lm, loess