Title: | Ternary Plots |
---|---|
Description: | Ternary plots made simple. This package allows to create ternary plots using 'graphics'. It provides functions to display the data in the ternary space, to add or tune graphical elements and to display statistical summaries. It also includes common ternary diagrams which are useful for the archaeologist (e.g. soil texture charts, ceramic phase diagram). |
Authors: | Nicolas Frerebeau [aut, cre] , Brice Lebrun [ctb] (<https://orcid.org/0000-0001-7503-8685>, Logo designer), Université Bordeaux Montaigne [fnd], CNRS [fnd] |
Maintainer: | Nicolas Frerebeau <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.3.0 |
Built: | 2024-11-25 15:16:36 UTC |
Source: | CRAN |
Sand, silt, clay compositions of 39 sediment samples at different water depths in an Arctic lake.
arctic
arctic
A data.frame
with 4 variables:
Water depth (m).
Aitchison, J. (1986). The Statistical Analysis of Compositional Data. London: Chapman and Hall. doi:10.1007/978-94-009-4109-0.
Compositions of 25 specimens of boxite.
boxite
boxite
A data.frame
with 5 variables:
albite.
blandite.
cornite.
daubite.
endite.
Aitchison, J. (1986). The Statistical Analysis of Compositional Data. London: Chapman and Hall. doi:10.1007/978-94-009-4109-0.
AFM compositions of 23 aphyric Skye lavas.
lava
lava
A data.frame
with 3 variables:
Na2O + K2O (percent).
Fe2O3 (percent).
MgO (percent).
Aitchison, J. (1986). The Statistical Analysis of Compositional Data. London: Chapman and Hall. doi:10.1007/978-94-009-4109-0.
Other datasets:
arctic
,
boxite
Draw arrows between pairs of points.
ternary_arrows(x0, y0, z0, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_arrows(x0, y0, z0, x1 = x0, y1 = y0, z1 = z0, ...)
ternary_arrows(x0, y0, z0, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_arrows(x0, y0, z0, x1 = x0, y1 = y0, z1 = z0, ...)
x0 , y0 , z0
|
A |
... |
Further arguments to be passed to |
x1 , y1 , z1
|
A |
ternary_arrows()
is called it for its side-effects.
N. Frerebeau
Other geometries:
ternary_crosshairs()
,
ternary_image()
,
ternary_labels()
,
ternary_lines()
,
ternary_points()
,
ternary_polygon()
,
ternary_segments()
,
ternary_text()
## Add arrows ternary_plot(NULL, panel.first = ternary_grid()) ternary_arrows(x0 = 40, y0 = 20, z0 = 40, x1 = 20, y1 = 40, z1 = 40)
## Add arrows ternary_plot(NULL, panel.first = ternary_grid()) ternary_arrows(x0 = 40, y0 = 20, z0 = 40, x1 = 20, y1 = 40, z1 = 40)
Adds an axis to the current plot.
ternary_axis( side, at = NULL, labels = TRUE, tick = TRUE, center = getOption("isopleuros.center"), scale = getOption("isopleuros.scale"), font = NA, lty = "solid", lwd = 1, lwd.ticks = lwd, col = NULL, col.ticks = NULL, ... )
ternary_axis( side, at = NULL, labels = TRUE, tick = TRUE, center = getOption("isopleuros.center"), scale = getOption("isopleuros.scale"), font = NA, lty = "solid", lwd = 1, lwd.ticks = lwd, col = NULL, col.ticks = NULL, ... )
side |
An |
at |
A |
labels |
A |
tick |
A |
center |
A |
scale |
A |
font |
font for text. Defaults to |
lty |
A |
lwd , lwd.ticks
|
A non-negative |
col , col.ticks
|
Colors for the axis line and the tick marks
respectively. Defaults to |
... |
Other graphical parameters may also be passed as
arguments to this function, particularly, |
ternary_axis()
is called it for its side-effects.
N. Frerebeau
Other graphical elements:
ternary_box()
,
ternary_grid()
,
ternary_pairs()
,
ternary_plot()
,
ternary_title()
## Add axis ternary_plot(NULL, axes = FALSE) ternary_axis(side = 1, col = "red") ternary_axis(side = 2, col = "blue") ternary_axis(side = 3, col = "green") ## Add box and grid ternary_plot(NULL, axes = FALSE) ternary_box(lty = "dashed", col = "red") ternary_grid(lty.primary = "dotted")
## Add axis ternary_plot(NULL, axes = FALSE) ternary_axis(side = 1, col = "red") ternary_axis(side = 2, col = "blue") ternary_axis(side = 3, col = "green") ## Add box and grid ternary_plot(NULL, axes = FALSE) ternary_box(lty = "dashed", col = "red") ternary_grid(lty.primary = "dotted")
Draw a Box around a Ternary Plot
ternary_box(lty = "solid", ...)
ternary_box(lty = "solid", ...)
lty |
A |
... |
Other graphical parameters may also be passed as
arguments to this function, particularly, |
ternary_box()
is called it for its side-effects.
N. Frerebeau
Other graphical elements:
ternary_axis()
,
ternary_grid()
,
ternary_pairs()
,
ternary_plot()
,
ternary_title()
## Add axis ternary_plot(NULL, axes = FALSE) ternary_axis(side = 1, col = "red") ternary_axis(side = 2, col = "blue") ternary_axis(side = 3, col = "green") ## Add box and grid ternary_plot(NULL, axes = FALSE) ternary_box(lty = "dashed", col = "red") ternary_grid(lty.primary = "dotted")
## Add axis ternary_plot(NULL, axes = FALSE) ternary_axis(side = 1, col = "red") ternary_axis(side = 2, col = "blue") ternary_axis(side = 3, col = "green") ## Add box and grid ternary_plot(NULL, axes = FALSE) ternary_box(lty = "dashed", col = "red") ternary_grid(lty.primary = "dotted")
Computes and draws contour lines.
ternary_contour(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_contour( x, y, z, value, n = 50, nlevels = 10, levels = pretty(range(value, na.rm = TRUE), nlevels), ilr = TRUE, method = "linear", extrapolate = FALSE, palette = function(i) grDevices::hcl.colors(i, "YlOrRd", rev = TRUE), ... ) ## S4 method for signature 'ANY,missing,missing' ternary_contour( x, value, n = 50, nlevels = 10, levels = pretty(range(value, na.rm = TRUE), nlevels), ilr = TRUE, method = "linear", extrapolate = FALSE, palette = function(i) grDevices::hcl.colors(i, "YlOrRd", rev = TRUE), ... )
ternary_contour(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_contour( x, y, z, value, n = 50, nlevels = 10, levels = pretty(range(value, na.rm = TRUE), nlevels), ilr = TRUE, method = "linear", extrapolate = FALSE, palette = function(i) grDevices::hcl.colors(i, "YlOrRd", rev = TRUE), ... ) ## S4 method for signature 'ANY,missing,missing' ternary_contour( x, value, n = 50, nlevels = 10, levels = pretty(range(value, na.rm = TRUE), nlevels), ilr = TRUE, method = "linear", extrapolate = FALSE, palette = function(i) grDevices::hcl.colors(i, "YlOrRd", rev = TRUE), ... )
x , y , z
|
A |
... |
Further arguments to be passed to |
value |
A |
n |
A length-one |
nlevels |
A length-one |
levels |
A |
ilr |
A |
method |
A |
extrapolate |
A |
palette |
A color palette |
Contour are computed from a bivariate interpolation onto a grid, after an isometric log ratio transformation of the original data.
ternary_contour()
is called it for its side-effects.
Invisibly returns a list
with elements levels
(the contour levels) and
colors
(the contour colors) that can be used for a legend.
The interp package needs to be installed on your machine.
N. Frerebeau
interp::interp()
, grDevices::contourLines()
Other statistics:
ternary_density()
,
ternary_ellipse()
,
ternary_hull()
,
ternary_mean()
,
ternary_pca()
## Add density ## Data from Aitchison 1986 ternary_plot(arctic, panel.first = ternary_grid()) levels <- ternary_contour(arctic, value = arctic$depth, n = 100, nlevels = 10) ## Add a legend legend_image <- grDevices::as.raster(rev(levels$colors)) graphics::rasterImage(legend_image, 0.85, 0.75, 0.9, 1) graphics::text(x = 0.9, y = c(0.75, 1), labels = range(levels$levels), pos = 4)
## Add density ## Data from Aitchison 1986 ternary_plot(arctic, panel.first = ternary_grid()) levels <- ternary_contour(arctic, value = arctic$depth, n = 100, nlevels = 10) ## Add a legend legend_image <- grDevices::as.raster(rev(levels$colors)) graphics::rasterImage(legend_image, 0.85, 0.75, 0.9, 1) graphics::text(x = 0.9, y = c(0.75, 1), labels = range(levels$levels), pos = 4)
Draw lines that intersect at a point.
ternary_crosshairs(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_crosshairs(x, y, z, x_mark = TRUE, y_mark = TRUE, z_mark = TRUE, ...) ## S4 method for signature 'ANY,missing,missing' ternary_crosshairs(x, x_mark = TRUE, y_mark = TRUE, z_mark = TRUE, ...)
ternary_crosshairs(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_crosshairs(x, y, z, x_mark = TRUE, y_mark = TRUE, z_mark = TRUE, ...) ## S4 method for signature 'ANY,missing,missing' ternary_crosshairs(x, x_mark = TRUE, y_mark = TRUE, z_mark = TRUE, ...)
x , y , z
|
A |
... |
Further graphical parameters (see |
x_mark , y_mark , z_mark
|
A |
ternary_crosshairs()
is called it for its side-effects.
N. Frerebeau
Other geometries:
ternary_arrows()
,
ternary_image()
,
ternary_labels()
,
ternary_lines()
,
ternary_points()
,
ternary_polygon()
,
ternary_segments()
,
ternary_text()
## Add cross-hairs ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid()) ternary_crosshairs(lava) ternary_plot(lava, panel.first = ternary_grid()) ternary_crosshairs(lava, y_mark = FALSE, z_mark = FALSE, col = "red") ternary_plot(lava, panel.first = ternary_grid()) ternary_crosshairs(lava, x_mark = FALSE, z_mark = FALSE, col = "green") ternary_plot(lava, panel.first = ternary_grid()) ternary_crosshairs(lava, x_mark = FALSE, y_mark = FALSE, col = "blue")
## Add cross-hairs ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid()) ternary_crosshairs(lava) ternary_plot(lava, panel.first = ternary_grid()) ternary_crosshairs(lava, y_mark = FALSE, z_mark = FALSE, col = "red") ternary_plot(lava, panel.first = ternary_grid()) ternary_crosshairs(lava, x_mark = FALSE, z_mark = FALSE, col = "green") ternary_plot(lava, panel.first = ternary_grid()) ternary_crosshairs(lava, x_mark = FALSE, y_mark = FALSE, col = "blue")
Computes and draws density contour lines.
ternary_density(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_density( x, y, z, h = NULL, n = 25, nlevels = 10, levels = NULL, palette = function(i) grDevices::hcl.colors(i, "YlOrRd", rev = TRUE), ... ) ## S4 method for signature 'ANY,missing,missing' ternary_density( x, h = NULL, n = 25, nlevels = 10, levels = NULL, palette = function(i) grDevices::hcl.colors(i, "YlOrRd", rev = TRUE), ... )
ternary_density(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_density( x, y, z, h = NULL, n = 25, nlevels = 10, levels = NULL, palette = function(i) grDevices::hcl.colors(i, "YlOrRd", rev = TRUE), ... ) ## S4 method for signature 'ANY,missing,missing' ternary_density( x, h = NULL, n = 25, nlevels = 10, levels = NULL, palette = function(i) grDevices::hcl.colors(i, "YlOrRd", rev = TRUE), ... )
x , y , z
|
A |
... |
Further arguments to be passed to |
h |
A length-one |
n |
A length-one |
nlevels |
A length-one |
levels |
A |
palette |
A color palette |
Two-dimensional kernel density estimation with an axis-aligned bivariate normal kernel. Normal kernel is evaluated on a square grid, after an isometric log ratio transformation of the original data.
ternary_density()
is called it for its side-effects.
Invisibly returns a list
with elements levels
(the contour levels) and
colors
(the contour colors) that can be used for a legend.
This must be considered as experimental and subject to major changes in a future release.
N. Frerebeau
Two-dimensional kernel density estimation is adapted from MASS::kde2d()
.
Other statistics:
ternary_contour()
,
ternary_ellipse()
,
ternary_hull()
,
ternary_mean()
,
ternary_pca()
## Add density ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid()) levels <- ternary_density(lava, n = 500, nlevels = 10) ## Add a legend legend_image <- grDevices::as.raster(rev(levels$colors)) graphics::rasterImage(legend_image, 0.85, 0.75, 0.9, 1) graphics::text(x = 0.9, y = c(0.75, 1), labels = range(levels$levels), pos = 4)
## Add density ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid()) levels <- ternary_density(lava, n = 500, nlevels = 10) ## Add a legend legend_image <- grDevices::as.raster(rev(levels$colors)) graphics::rasterImage(legend_image, 0.85, 0.75, 0.9, 1) graphics::text(x = 0.9, y = c(0.75, 1), labels = range(levels$levels), pos = 4)
Computes and draws a confidence/tolerance ellipse.
ternary_ellipse(x, y, z, ...) ternary_confidence(x, y, z, ...) ternary_tolerance(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_ellipse(x, y, z, radius = 1, ...) ## S4 method for signature 'ANY,missing,missing' ternary_ellipse(x, radius = 1, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_confidence(x, y, z, level = 0.95, ...) ## S4 method for signature 'ANY,missing,missing' ternary_confidence(x, level = 0.95, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_tolerance(x, y, z, level = 0.95, ...) ## S4 method for signature 'ANY,missing,missing' ternary_tolerance(x, level = 0.95, ...)
ternary_ellipse(x, y, z, ...) ternary_confidence(x, y, z, ...) ternary_tolerance(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_ellipse(x, y, z, radius = 1, ...) ## S4 method for signature 'ANY,missing,missing' ternary_ellipse(x, radius = 1, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_confidence(x, y, z, level = 0.95, ...) ## S4 method for signature 'ANY,missing,missing' ternary_confidence(x, level = 0.95, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_tolerance(x, y, z, level = 0.95, ...) ## S4 method for signature 'ANY,missing,missing' ternary_tolerance(x, level = 0.95, ...)
x , y , z
|
A |
... |
Further arguments to be passed to |
radius |
A |
level |
A |
Ellipse coordinates are computed after an isometric log ratio transformation of the original data.
ternary_ellipse()
is called it for its side-effects.
N. Frerebeau
Other statistics:
ternary_contour()
,
ternary_density()
,
ternary_hull()
,
ternary_mean()
,
ternary_pca()
## Ellipses ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid(5, 10)) ternary_tolerance(lava, level = 0.95, border = "blue", lty = 2) ternary_confidence(lava, level = 0.95, border = "red", lty = 3)
## Ellipses ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid(5, 10)) ternary_tolerance(lava, level = 0.95, border = "blue", lty = 2) ternary_confidence(lava, level = 0.95, border = "red", lty = 3)
Adds a triangular grid to an existing plot.
ternary_grid( primary = NULL, secondary = NULL, center = getOption("isopleuros.center"), scale = getOption("isopleuros.scale"), col.primary = "darkgray", col.secondary = "lightgray", lty.primary = "dashed", lty.secondary = "dotted", lwd.primary = 1, lwd.secondary = lwd.primary )
ternary_grid( primary = NULL, secondary = NULL, center = getOption("isopleuros.center"), scale = getOption("isopleuros.scale"), col.primary = "darkgray", col.secondary = "lightgray", lty.primary = "dashed", lty.secondary = "dotted", lwd.primary = 1, lwd.secondary = lwd.primary )
primary |
An |
secondary |
An |
center |
A |
scale |
A |
col.primary , col.secondary
|
A |
lty.primary , lty.secondary
|
A |
lwd.primary , lwd.secondary
|
A non-negative |
ternary_grid()
is called it for its side-effects.
N. Frerebeau
Other graphical elements:
ternary_axis()
,
ternary_box()
,
ternary_pairs()
,
ternary_plot()
,
ternary_title()
## Data from Aitchison 1986 ternary_plot(lava, center = FALSE, scale = FALSE, col = "red", pch = 16) ternary_grid(5) ## Center z <- ternary_plot(lava, center = TRUE, col = "blue", pch = 16) ternary_grid(5, center = z$center) ## Center and scale z <- ternary_plot(lava, center = TRUE, scale = TRUE, col = "green", pch = 16) ternary_grid(5, center = z$center, scale = z$scale)
## Data from Aitchison 1986 ternary_plot(lava, center = FALSE, scale = FALSE, col = "red", pch = 16) ternary_grid(5) ## Center z <- ternary_plot(lava, center = TRUE, col = "blue", pch = 16) ternary_grid(5, center = z$center) ## Center and scale z <- ternary_plot(lava, center = TRUE, scale = TRUE, col = "green", pch = 16) ternary_grid(5, center = z$center, scale = z$scale)
Computes and draws the convex hull of the set of points specified.
ternary_hull(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_hull(x, y, z, center = FALSE, scale = FALSE, ...) ## S4 method for signature 'ANY,missing,missing' ternary_hull(x, center = FALSE, scale = FALSE, ...)
ternary_hull(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_hull(x, y, z, center = FALSE, scale = FALSE, ...) ## S4 method for signature 'ANY,missing,missing' ternary_hull(x, center = FALSE, scale = FALSE, ...)
x , y , z
|
A |
... |
Further arguments to be passed to |
center |
A |
scale |
A |
ternary_hull()
is called it for its side-effects.
N. Frerebeau
grDevices::chull()
, graphics::polygon()
Other statistics:
ternary_contour()
,
ternary_density()
,
ternary_ellipse()
,
ternary_mean()
,
ternary_pca()
## Convex hull ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid(5, 10)) ternary_hull(lava, border = "red")
## Convex hull ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid(5, 10)) ternary_hull(lava, border = "red")
Creates a grid of colored triangles with colors corresponding to the output of a function.
ternary_image(f, ...) ## S4 method for signature 'function' ternary_image(f, n = 48, palette = NULL, ...)
ternary_image(f, ...) ## S4 method for signature 'function' ternary_image(f, n = 48, palette = NULL, ...)
f |
A |
... |
Further parameters to be passed to |
n |
A length-one |
palette |
A |
ternary_image()
is called it for its side-effects.
N. Frerebeau
Other geometries:
ternary_arrows()
,
ternary_crosshairs()
,
ternary_labels()
,
ternary_lines()
,
ternary_points()
,
ternary_polygon()
,
ternary_segments()
,
ternary_text()
## RGB ternary_plot(NULL, xlab = "Red", ylab = "Green", zlab = "Blue") ternary_image(f = rgb, n = 20, palette = FALSE)
## RGB ternary_plot(NULL, xlab = "Red", ylab = "Green", zlab = "Blue") ternary_image(f = rgb, n = 20, palette = FALSE)
Optimize the location of text labels to minimize overplotting text.
ternary_labels(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_labels( x, y, z, center = FALSE, scale = FALSE, labels = seq_along(x), type = c("text", "shadow"), ... ) ## S4 method for signature 'ANY,missing,missing' ternary_labels(x, center = FALSE, scale = FALSE, labels = seq_along(x$x), ...)
ternary_labels(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_labels( x, y, z, center = FALSE, scale = FALSE, labels = seq_along(x), type = c("text", "shadow"), ... ) ## S4 method for signature 'ANY,missing,missing' ternary_labels(x, center = FALSE, scale = FALSE, labels = seq_along(x$x), ...)
x , y , z
|
A |
... |
Further graphical parameters (see |
center |
A |
scale |
A |
labels |
A |
type |
A |
ternary_labels()
is called it for its side-effects.
N. Frerebeau
Other geometries:
ternary_arrows()
,
ternary_crosshairs()
,
ternary_image()
,
ternary_lines()
,
ternary_points()
,
ternary_polygon()
,
ternary_segments()
,
ternary_text()
## Compositional data coda <- data.frame( X = c(41.0, 40, 39.0), Y = c(19.5, 20, 20.5), Z = c(39.5, 40, 40.5) ) ## Add text ternary_plot(NULL, panel.first = ternary_grid()) ternary_points(coda) ternary_labels(coda, labels = c("A", "B", "C"))
## Compositional data coda <- data.frame( X = c(41.0, 40, 39.0), Y = c(19.5, 20, 20.5), Z = c(39.5, 40, 40.5) ) ## Add text ternary_plot(NULL, panel.first = ternary_grid()) ternary_points(coda) ternary_labels(coda, labels = c("A", "B", "C"))
Add Connected Line Segments to a Ternary Plot
ternary_lines(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_lines(x, y, z, type = "l", ...) ## S4 method for signature 'ANY,missing,missing' ternary_lines(x, type = "l", ...)
ternary_lines(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_lines(x, y, z, type = "l", ...) ## S4 method for signature 'ANY,missing,missing' ternary_lines(x, type = "l", ...)
x , y , z
|
A |
... |
Further graphical parameters (see |
type |
A |
ternary_lines()
is called it for its side-effects.
N. Frerebeau
Other geometries:
ternary_arrows()
,
ternary_crosshairs()
,
ternary_image()
,
ternary_labels()
,
ternary_points()
,
ternary_polygon()
,
ternary_segments()
,
ternary_text()
## Compositional data coda <- data.frame( X = c(20, 60, 20, 20), Y = c(20, 20, 60, 40), Z = c(60, 20, 20, 40) ) ## Add lines ternary_plot(NULL, panel.first = ternary_grid()) ternary_lines(coda, col = "red", lwd = 2)
## Compositional data coda <- data.frame( X = c(20, 60, 20, 20), Y = c(20, 20, 60, 40), Z = c(60, 20, 20, 40) ) ## Add lines ternary_plot(NULL, panel.first = ternary_grid()) ternary_lines(coda, col = "red", lwd = 2)
Computes and draws the closed geometric mean of the set of points specified.
ternary_mean(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_mean(x, y, z, ...) ## S4 method for signature 'ANY,missing,missing' ternary_mean(x, y, z, ...)
ternary_mean(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_mean(x, y, z, ...) ## S4 method for signature 'ANY,missing,missing' ternary_mean(x, y, z, ...)
x , y , z
|
A |
... |
Further arguments to be passed to |
ternary_mean()
is called it for its side-effects.
N. Frerebeau
Other statistics:
ternary_contour()
,
ternary_density()
,
ternary_ellipse()
,
ternary_hull()
,
ternary_pca()
## Mean ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid()) ternary_mean(lava, pch = 16, col = "red") ternary_confidence(lava, level = 0.95, border = "red", lty = 1)
## Mean ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid()) ternary_mean(lava, pch = 16, col = "red") ternary_confidence(lava, level = 0.95, border = "red", lty = 1)
Produces a matrix of ternary plots.
ternary_pairs(x, ...) ## S4 method for signature 'matrix' ternary_pairs(x, margin = NULL, ...) ## S4 method for signature 'data.frame' ternary_pairs(x, margin = NULL, ...)
ternary_pairs(x, ...) ## S4 method for signature 'matrix' ternary_pairs(x, margin = NULL, ...) ## S4 method for signature 'data.frame' ternary_pairs(x, margin = NULL, ...)
x |
A |
... |
Further graphical parameters. |
margin |
A |
ternary_pairs()
is called it for its side-effects: it results in a graphic
being displayed. Invisibly returns x
.
N. Frerebeau
Other graphical elements:
ternary_axis()
,
ternary_box()
,
ternary_grid()
,
ternary_plot()
,
ternary_title()
## Data from Aitchison 1986 ## Ternary plots with marginal compositions ternary_pairs(boxite) ## Ternary plots with endite ternary_pairs(boxite, margin = "E")
## Data from Aitchison 1986 ## Ternary plots with marginal compositions ternary_pairs(boxite) ## Ternary plots with endite ternary_pairs(boxite, margin = "E")
Computes and draws principal component.
ternary_pca(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_pca(x, y, z, axis = 1, ...) ## S4 method for signature 'ANY,missing,missing' ternary_pca(x, axis = 1, ...)
ternary_pca(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_pca(x, y, z, axis = 1, ...) ## S4 method for signature 'ANY,missing,missing' ternary_pca(x, axis = 1, ...)
x , y , z
|
A |
... |
Further arguments to be passed to |
axis |
An |
ternary_pca()
is called it for its side-effects.
N. Frerebeau
Other statistics:
ternary_contour()
,
ternary_density()
,
ternary_ellipse()
,
ternary_hull()
,
ternary_mean()
## PCA ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid()) ternary_pca(lava, axis = 1, col = "red", lty = 2)
## PCA ## Data from Aitchison 1986 ternary_plot(lava, panel.first = ternary_grid()) ternary_pca(lava, axis = 1, col = "red", lty = 2)
Produces a ternary plot.
ternary_plot(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_plot( x, y, z, center = FALSE, scale = FALSE, xlim = NULL, ylim = NULL, zlim = NULL, xlab = NULL, ylab = NULL, zlab = NULL, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... ) ## S4 method for signature 'ANY,missing,missing' ternary_plot( x, xlim = NULL, ylim = NULL, zlim = NULL, xlab = NULL, ylab = NULL, zlab = NULL, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
ternary_plot(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_plot( x, y, z, center = FALSE, scale = FALSE, xlim = NULL, ylim = NULL, zlim = NULL, xlab = NULL, ylab = NULL, zlab = NULL, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... ) ## S4 method for signature 'ANY,missing,missing' ternary_plot( x, xlim = NULL, ylim = NULL, zlim = NULL, xlab = NULL, ylab = NULL, zlab = NULL, main = NULL, sub = NULL, ann = graphics::par("ann"), axes = TRUE, frame.plot = axes, panel.first = NULL, panel.last = NULL, ... )
x , y , z
|
A |
... |
Other graphical parameters may also be passed as arguments to this function. |
center |
A |
scale |
A |
xlim |
A length-three |
ylim |
A length-three |
zlim |
A length-three |
xlab , ylab , zlab
|
A |
main |
A |
sub |
A |
ann |
A |
axes |
A |
frame.plot |
A |
panel.first |
An an |
panel.last |
An |
ternary_plot()
is called it for its side-effects: it results in a graphic
being displayed. Invisibly returns a list
with the components:
x |
A numeric vector of x values. |
y |
A numeric vector of y values. |
z |
A numeric vector of z values. |
center |
A numeric vector giving the center. |
scale |
A numeric vector giving the scale factor. |
N. Frerebeau
Other graphical elements:
ternary_axis()
,
ternary_box()
,
ternary_grid()
,
ternary_pairs()
,
ternary_title()
## Blank plot ternary_plot(NULL) ## Compositional data coda <- data.frame( X = c(20, 60, 20, 1/3), Y = c(20, 20, 60, 1/3), Z = c(60, 20, 20, 1/3) ) ## Ternary plot ternary_plot(coda, pch = 16, col = "red") ## Add a grid ternary_plot(coda, panel.first = ternary_grid(5, 10)) ## Zoom ternary_plot(coda, ylim = c(0, 0.4, 0), zlim = c(0, 0, 0.4), panel.first = ternary_grid()) ternary_plot(coda, xlim = c(0, 0.4, 0), zlim = c(0, 0, 0.4), panel.first = ternary_grid()) ternary_plot(coda, xlim = c(0.4, 0, 0), ylim = c(0, 0.4, 0), panel.first = ternary_grid()) ## Color according to a supplementary variable ## Data from Aitchison 1986 col <- grDevices::colorRampPalette(c("red", "blue"))(nrow(arctic)) ternary_plot(arctic, panel.first = ternary_grid(), pch = 16, col = col)
## Blank plot ternary_plot(NULL) ## Compositional data coda <- data.frame( X = c(20, 60, 20, 1/3), Y = c(20, 20, 60, 1/3), Z = c(60, 20, 20, 1/3) ) ## Ternary plot ternary_plot(coda, pch = 16, col = "red") ## Add a grid ternary_plot(coda, panel.first = ternary_grid(5, 10)) ## Zoom ternary_plot(coda, ylim = c(0, 0.4, 0), zlim = c(0, 0, 0.4), panel.first = ternary_grid()) ternary_plot(coda, xlim = c(0, 0.4, 0), zlim = c(0, 0, 0.4), panel.first = ternary_grid()) ternary_plot(coda, xlim = c(0.4, 0, 0), ylim = c(0, 0.4, 0), panel.first = ternary_grid()) ## Color according to a supplementary variable ## Data from Aitchison 1986 col <- grDevices::colorRampPalette(c("red", "blue"))(nrow(arctic)) ternary_plot(arctic, panel.first = ternary_grid(), pch = 16, col = col)
Add Points to a Ternary Plot
ternary_points(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_points(x, y, z, center = FALSE, scale = FALSE, type = "p", ...) ## S4 method for signature 'ANY,missing,missing' ternary_points(x, center = FALSE, scale = FALSE, type = "p", ...)
ternary_points(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_points(x, y, z, center = FALSE, scale = FALSE, type = "p", ...) ## S4 method for signature 'ANY,missing,missing' ternary_points(x, center = FALSE, scale = FALSE, type = "p", ...)
x , y , z
|
A |
... |
Further graphical parameters (see |
center |
A |
scale |
A |
type |
A |
ternary_points()
is called it for its side-effects. Invisibly returns
a list
with the components:
x |
A numeric vector of x values. |
y |
A numeric vector of y values. |
z |
A numeric vector of z values. |
center |
A numeric vector giving the center. |
scale |
A numeric vector giving the scale factor. |
N. Frerebeau
Other geometries:
ternary_arrows()
,
ternary_crosshairs()
,
ternary_image()
,
ternary_labels()
,
ternary_lines()
,
ternary_polygon()
,
ternary_segments()
,
ternary_text()
## Add points ## Data from Aitchison 1986 ternary_plot(NULL, panel.first = ternary_grid()) ternary_points(lava, col = "red", pch = 16) ## Center and scale ternary_plot(NULL, axes = FALSE, frame.plot = TRUE) ternary_points(lava, col = "red", pch = 16) ternary_points(lava, center = TRUE, col = "blue", pch = 16) ternary_points(lava, center = TRUE, scale = TRUE, col = "green", pch = 16)
## Add points ## Data from Aitchison 1986 ternary_plot(NULL, panel.first = ternary_grid()) ternary_points(lava, col = "red", pch = 16) ## Center and scale ternary_plot(NULL, axes = FALSE, frame.plot = TRUE) ternary_points(lava, col = "red", pch = 16) ternary_points(lava, center = TRUE, col = "blue", pch = 16) ternary_points(lava, center = TRUE, scale = TRUE, col = "green", pch = 16)
Draws the polygons whose vertices are given in x
, y
and z
.
ternary_polygon(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_polygon(x, y, z, ...) ## S4 method for signature 'ANY,missing,missing' ternary_polygon(x, y, z, ...)
ternary_polygon(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_polygon(x, y, z, ...) ## S4 method for signature 'ANY,missing,missing' ternary_polygon(x, y, z, ...)
x , y , z
|
A |
... |
Further arguments to be passed to |
ternary_polygon()
is called it for its side-effects.
N. Frerebeau
Other geometries:
ternary_arrows()
,
ternary_crosshairs()
,
ternary_image()
,
ternary_labels()
,
ternary_lines()
,
ternary_points()
,
ternary_segments()
,
ternary_text()
## Compositional data coda <- data.frame( X = c(20, 60, 20), Y = c(20, 20, 60), Z = c(60, 20, 20) ) ## Add a polygon ternary_plot(NULL, panel.first = ternary_grid()) ternary_polygon(coda, density = 5, border = "red")
## Compositional data coda <- data.frame( X = c(20, 60, 20), Y = c(20, 20, 60), Z = c(60, 20, 20) ) ## Add a polygon ternary_plot(NULL, panel.first = ternary_grid()) ternary_polygon(coda, density = 5, border = "red")
Draw line segments between pairs of points.
ternary_segments(x0, y0, z0, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_segments(x0, y0, z0, x1 = x0, y1 = y0, z1 = z0, ...)
ternary_segments(x0, y0, z0, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_segments(x0, y0, z0, x1 = x0, y1 = y0, z1 = z0, ...)
x0 , y0 , z0
|
A |
... |
Further graphical parameters (see |
x1 , y1 , z1
|
A |
ternary_segments()
is called it for its side-effects.
N. Frerebeau
Other geometries:
ternary_arrows()
,
ternary_crosshairs()
,
ternary_image()
,
ternary_labels()
,
ternary_lines()
,
ternary_points()
,
ternary_polygon()
,
ternary_text()
## Add segments ternary_plot(NULL, panel.first = ternary_grid()) ternary_segments(x0 = 40, y0 = 20, z0 = 40, x1 = 20, y1 = 40, z1 = 40)
## Add segments ternary_plot(NULL, panel.first = ternary_grid()) ternary_segments(x0 = 40, y0 = 20, z0 = 40, x1 = 20, y1 = 40, z1 = 40)
Draws the strings given in the vector labels
at the coordinates given by
x
, y
and z
.
ternary_text(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_text( x, y, z, center = FALSE, scale = FALSE, labels = seq_along(x), ... ) ## S4 method for signature 'ANY,missing,missing' ternary_text(x, center = FALSE, scale = FALSE, labels = seq_along(x$x), ...)
ternary_text(x, y, z, ...) ## S4 method for signature 'numeric,numeric,numeric' ternary_text( x, y, z, center = FALSE, scale = FALSE, labels = seq_along(x), ... ) ## S4 method for signature 'ANY,missing,missing' ternary_text(x, center = FALSE, scale = FALSE, labels = seq_along(x$x), ...)
x , y , z
|
A |
... |
Further arguments to be passed to |
center |
A |
scale |
A |
labels |
A |
ternary_text()
is called it for its side-effects.
N. Frerebeau
Other geometries:
ternary_arrows()
,
ternary_crosshairs()
,
ternary_image()
,
ternary_labels()
,
ternary_lines()
,
ternary_points()
,
ternary_polygon()
,
ternary_segments()
## Compositional data coda <- data.frame( X = c(20, 60, 20), Y = c(20, 20, 60), Z = c(60, 20, 20) ) ## Add text ternary_plot(NULL, panel.first = ternary_grid()) ternary_text(coda, labels = c("A", "B", "C"), col = "red", cex = 2)
## Compositional data coda <- data.frame( X = c(20, 60, 20), Y = c(20, 20, 60), Z = c(60, 20, 20) ) ## Add text ternary_plot(NULL, panel.first = ternary_grid()) ternary_text(coda, labels = c("A", "B", "C"), col = "red", cex = 2)
Ternary Plot Annotation
ternary_title( main = NULL, sub = NULL, xlab = NULL, ylab = NULL, zlab = NULL, line = NA, outer = FALSE, ... )
ternary_title( main = NULL, sub = NULL, xlab = NULL, ylab = NULL, zlab = NULL, line = NA, outer = FALSE, ... )
main |
A |
sub |
A |
xlab , ylab , zlab
|
A |
line |
Specifying a value for |
outer |
A |
... |
Other graphical parameters may also be passed as
arguments to this function, particularly, |
ternary_title()
is called it for its side-effects.
N. Frerebeau
Other graphical elements:
ternary_axis()
,
ternary_box()
,
ternary_grid()
,
ternary_pairs()
,
ternary_plot()
## Add title ternary_plot(NULL, main = "Main title", sub = "Subtitle", xlab = "A", ylab = "B", zlab = "C") ternary_plot(NULL, ann = FALSE) ternary_title(main = "Main title", sub = "Subtitle", xlab = "A", ylab = "B", zlab = "C")
## Add title ternary_plot(NULL, main = "Main title", sub = "Subtitle", xlab = "A", ylab = "B", zlab = "C") ternary_plot(NULL, ann = FALSE) ternary_title(main = "Main title", sub = "Subtitle", xlab = "A", ylab = "B", zlab = "C")
Ceramic Phase Diagram
triangle_phase_cas(labels = TRUE, symbol = FALSE, mol = FALSE, ...) triangle_phase_ceramic(labels = TRUE, symbol = FALSE, mol = FALSE, ...)
triangle_phase_cas(labels = TRUE, symbol = FALSE, mol = FALSE, ...) triangle_phase_ceramic(labels = TRUE, symbol = FALSE, mol = FALSE, ...)
labels |
A |
symbol |
A |
mol |
A |
... |
Further arguments to be passed to |
N. Frerebeau
Other charts:
triangle_soil
## Ceramic phase diagram ternary_plot(NULL, xlab = "CaO", ylab = "Al2O3", zlab = "SiO2") triangle_phase_ceramic(symbol = TRUE, mol = TRUE, pch = 16) ternary_plot(NULL, xlab = "CaO", ylab = "Al2O3", zlab = "SiO2") triangle_phase_ceramic(symbol = TRUE, mol = FALSE, pch = 16) ## CAS diagram ternary_plot(NULL, axes = FALSE, ann = FALSE, frame.plot = TRUE) triangle_phase_cas(mol = FALSE, pch = 16)
## Ceramic phase diagram ternary_plot(NULL, xlab = "CaO", ylab = "Al2O3", zlab = "SiO2") triangle_phase_ceramic(symbol = TRUE, mol = TRUE, pch = 16) ternary_plot(NULL, xlab = "CaO", ylab = "Al2O3", zlab = "SiO2") triangle_phase_ceramic(symbol = TRUE, mol = FALSE, pch = 16) ## CAS diagram ternary_plot(NULL, axes = FALSE, ann = FALSE, frame.plot = TRUE) triangle_phase_cas(mol = FALSE, pch = 16)
Soil Texture Triangle
triangle_soil_hypres(labels = TRUE, symbol = FALSE, ...) triangle_soil_folk(labels = TRUE, symbol = FALSE, ...) triangle_soil_shepard(labels = TRUE, symbol = FALSE, ...) triangle_soil_usda(labels = TRUE, symbol = FALSE, ...)
triangle_soil_hypres(labels = TRUE, symbol = FALSE, ...) triangle_soil_folk(labels = TRUE, symbol = FALSE, ...) triangle_soil_shepard(labels = TRUE, symbol = FALSE, ...) triangle_soil_usda(labels = TRUE, symbol = FALSE, ...)
labels |
A |
symbol |
A |
... |
Further arguments to be passed to |
N. Frerebeau
Other charts:
triangle_phase_cas()
## HYPRES soil texture ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay") triangle_soil_hypres() ## USDA (1951) soil texture ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay") triangle_soil_usda(symbol = TRUE) ## Folk (1954) soil texture ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay") triangle_soil_folk(symbol = TRUE) ## Shepard (1954) soil texture ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay") triangle_soil_shepard()
## HYPRES soil texture ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay") triangle_soil_hypres() ## USDA (1951) soil texture ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay") triangle_soil_usda(symbol = TRUE) ## Folk (1954) soil texture ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay") triangle_soil_folk(symbol = TRUE) ## Shepard (1954) soil texture ternary_plot(NULL, xlab = "sand", ylab = "silt", zlab = "clay") triangle_soil_shepard()