Description Usage Arguments Examples
View source: R/scale_continuous_asym.R
This is a this wrapper around continuous_scale()
from
the 'ggplot2' package. It is generally best to call this function
implicitly using one of the wrappers that have the general naming
scheme of scale_*_tl/br_*()
(such as
scale_fill_tl_gradient()
).
1 | continuous_scale_asym(aesthetics, scale_name, palette, na.value, guide, ...)
|
aesthetics |
The names of the aesthetics that this scale works with |
scale_name |
The name of the scale |
palette |
A palette function that when called with a numeric vector with values between 0 and 1 returns the corresponding values in the range the scale maps to. |
na.value |
Missing values will be replaced with this value. |
guide |
A function used to create a guide or its name. See
|
... |
other input is passed on to |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(tibble)
library(ggplot2)
tib <- tibble(
g1 = c("A", "A", "B"),
g2 = c("B", "C", "C"),
val_1 = c(1, 2, 3),
val_2 = c(-1, 0, 1)
)
tib
tib <- asymmetrise(tib, g1, g2)
ggplot(tib) +
geom_asymmat(aes(x = g1, y = g2, fill_tl = val_1, fill_br = val_2)) +
scale_fill_tl_gradient(low = "lightpink", high = "tomato") +
scale_fill_br_gradient(low = "lightblue1", high = "dodgerblue") +
labs(fill_tl = "top-left fill", fill_br = "bottom-right fill")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.