ternary_tile | R Documentation |
Compute tile values.
tile_bin(x, y, z, ...)
tile_density(x, y, z, ...)
tile_interpolate(x, y, z, ...)
## S4 method for signature 'numeric,numeric,numeric'
tile_bin(x, y, z)
## S4 method for signature 'ANY,missing,missing'
tile_bin(x)
## S4 method for signature 'numeric,numeric,numeric'
tile_density(x, y, z)
## S4 method for signature 'ANY,missing,missing'
tile_density(x)
## S4 method for signature 'numeric,numeric,numeric'
tile_interpolate(x, y, z, value, method = "linear", ...)
## S4 method for signature 'ANY,missing,missing'
tile_interpolate(x, value, method = "linear", ...)
x , y , z |
A |
... |
Further parameters to be passed to internal methods. |
value |
A |
method |
A |
A function
that takes three numeric
vector as arguments and returns
a numeric
vector.
N. Frerebeau
ternary_image()
## Data from Aitchison 1986
## Bin
f <- tile_bin(lava)
ternary_plot(NULL)
ternary_image(f = f, n = 12)
## Custom color palette
pal <- function(x) {
x <- (x - min(x)) / (max(x) - min(x)) # Rescale to [0,1]
YlOrBr <- c("#FFFFD4", "#FED98E", "#FE9929", "#D95F0E", "#993404")
RGB <- grDevices::colorRamp(YlOrBr)(x)
grDevices::rgb(RGB, maxColorValue = 255)
}
ternary_plot(NULL)
ternary_image(f = f, n = 12, palette = pal)
## Density
f <- tile_density(lava)
ternary_plot(NULL)
ternary_image(f = f, n = 12, palette = pal)
if (requireNamespace("interp", quietly = TRUE)) {
## Interpolation
f <- tile_interpolate(arctic, value = arctic$depth)
ternary_plot(NULL)
ternary_image(f = f, n = 24, palette = pal)
ternary_points(arctic, col = "red", pch = 16)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.