ternary_contour | R Documentation |
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),
...
)
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 the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.