f <- set_hinge(c(-3, 7), hinge = 0)
f(n = 19) |> plot()
x <- datasets::volcano
f <- set_hinge(x, hinge = 140, scheme = c("abyss", "dem1"))
filled.contour(x, color.palette = f, nlevels = 50, plot.axes = FALSE)
# Data range (x)
hinge <- 0
n <- 20
op <- par(mfrow = c(5, 1), oma = c(0, 0, 0, 0))
set_hinge(c(-10, 0), hinge)(n) |> plot()
set_hinge(c(-7, 3), hinge)(n) |> plot()
set_hinge(c(-5, 5), hinge)(n) |> plot()
set_hinge(c(-3, 7), hinge)(n) |> plot()
set_hinge(c(0, 10), hinge)(n) |> plot()
par(op)
# Hinge value (hinge)
x <- c(-5, 5)
n <- 255
op <- par(mfrow = c(5, 1), oma = c(0, 0, 0, 0))
set_hinge(x, hinge = -6)(n) |> plot()
set_hinge(x, hinge = -2)(n) |> plot()
set_hinge(x, hinge = 0)(n) |> plot()
set_hinge(x, hinge = 2)(n) |> plot()
set_hinge(x, hinge = 6)(n) |> plot()
par(op)
# Color scheme (scheme)
x <- c(-10, 10)
hinge <- -3
n <- 255
op <- par(mfrow = c(3, 1), oma = c(0, 0, 0, 0))
set_hinge(x, hinge, scheme = "romaO")(n) |> plot()
set_hinge(x, hinge, scheme = "BuRd")(n) |> plot()
set_hinge(x, hinge, scheme = c("ocean", "copper"))(n) |> plot()
par(op)
# Alpha transparency (alpha)
x <- c(-5, 5)
hinge <- 0
scheme <- c("drywet", "hawaii")
n <- 255
op <- par(mfrow = c(4, 1), oma = c(0, 0, 0, 0))
set_hinge(x, hinge, scheme, alpha = 1.0)(n) |> plot()
set_hinge(x, hinge, scheme, alpha = 0.5)(n) |> plot()
set_hinge(x, hinge, scheme, alpha = c(1.0, 0.5))(n) |> plot()
set_hinge(x, hinge, scheme, alpha = c(0.5, 1.0))(n) |> plot()
par(op)
# Reverse colors (reverse)
x <- c(-10, 10)
hinge <- -3
n <- 255
op <- par(mfrow = c(6, 1), oma = c(0, 0, 0, 0))
set_hinge(x, hinge, "romaO", reverse = FALSE)(n) |> plot()
set_hinge(x, hinge, "romaO", reverse = TRUE)(n) |> plot()
set_hinge(x, hinge, c("davos", "hawaii"), reverse = FALSE)(n) |> plot()
set_hinge(x, hinge, c("davos", "hawaii"), reverse = TRUE)(n) |> plot()
set_hinge(x, hinge, c("davos", "hawaii"), reverse = c(TRUE, FALSE))(n) |> plot()
set_hinge(x, hinge, c("davos", "hawaii"), reverse = c(FALSE, TRUE))(n) |> plot()
par(op)
# Buffer around hinge (buffer)
x <- c(-5, 5)
hinge <- -2
n <- 20
op <- par(mfrow = c(6, 1), oma = c(0, 0, 0, 0))
set_hinge(x, hinge, buffer = 0.0)(n) |> plot()
set_hinge(x, hinge, buffer = 0.2)(n) |> plot()
set_hinge(x, hinge, buffer = c(0.4, 0.2))(n) |> plot()
set_hinge(x, hinge, c("gray", "plasma"), buffer = 0.0)(n) |> plot()
set_hinge(x, hinge, c("gray", "plasma"), buffer = 0.2)(n) |> plot()
set_hinge(x, hinge, c("gray", "plasma"), buffer = c(0.2, 0.4))(n) |> plot()
par(op)
# Color stops (stops)
x <- c(-5, 5)
hinge <- 1
n <- 20
op <- par(mfrow = c(6, 1), oma = c(0, 0, 0, 0))
set_hinge(x, hinge, stops = c(0.0, 1.0))(n) |> plot()
set_hinge(x, hinge, stops = c(0.2, 0.8))(n) |> plot()
set_hinge(x, hinge, stops = c(0.4, 0.6))(n) |> plot()
set_hinge(x, hinge, c("gray", "plasma"), stops = c(0.0, 1.0))(n) |> plot()
set_hinge(x, hinge, c("gray", "plasma"), stops = c(0.2, 0.8))(n) |> plot()
set_hinge(x, hinge, c("gray", "plasma"), stops = c(0.4, 0.6))(n) |> plot()
par(op)
# Allow bias (allow_bias)
x <- c(-3, 7)
n <- 20
op <- par(mfrow = c(4, 1), oma = c(0, 0, 0, 0))
set_hinge(x, hinge = 0, allow_bias = TRUE)(n) |> plot()
set_hinge(x, hinge = 0, allow_bias = FALSE)(n) |> plot()
set_hinge(x, hinge = 4, allow_bias = TRUE)(n) |> plot()
set_hinge(x, hinge = 4, allow_bias = FALSE)(n) |> plot()
par(op)
Run the code above in your browser using DataLab