check-scalar-isGgscale | R Documentation |
Does the input contain a ggplot2 scale?
isGgscale(
x,
scale = c("continuous", "discrete"),
aes = c("color", "colour", "fill"),
nullOk = FALSE
)
x |
Object. |
scale |
|
aes |
|
nullOk |
|
TRUE
on success;
FALSE
on failure, with cause set.
Updated 2019-09-14.
library(ggplot2)
color_c <- scale_color_gradient(low = "red", high = "blue")
class(color_c)
color_d <- scale_color_manual(values = c("red", "blue"))
class(color_d)
fill_c <- scale_fill_gradient(low = "red", high = "blue")
class(fill_c)
fill_d <- scale_fill_manual(values = c("red", "blue"))
class(fill_d)
isGgscale(x = color_c, scale = "continuous", aes = "color")
isGgscale(x = color_d, scale = "discrete", aes = "color")
isGgscale(x = fill_c, scale = "continuous", aes = "fill")
isGgscale(x = fill_d, scale = "discrete", aes = "fill")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.