scale-palettehex | R Documentation |
Colour and fill scales for ggplot2
plots, using object of class palettehex
.
scale_colour_palettehex_d(x, which = 1, reverse = FALSE, ...)
scale_color_palettehex_d(x, which = 1, reverse = FALSE, ...)
scale_fill_palettehex_d(x, which = 1, reverse = FALSE, ...)
scale_colour_palettehex_c(x, which = 1, reverse = FALSE, ...)
scale_color_palettehex_c(x, which = 1, reverse = FALSE, ...)
scale_fill_palettehex_c(x, which = 1, reverse = FALSE, ...)
x |
object of class |
which |
selection of which palette of a set to choose. Either by name, id or numeric index. |
reverse |
logical. If scale should b reversed (default: FALSE) |
... |
arguments to be passed to |
The palettehex
class is a data.frame of
many palettes. This function takes such a data.frame
and a choice of palette by name, id or numeric index
can be made for the scale.
ggplot2-proto
scale_colour_palettehex_d()
: Discrete colour scale
scale_color_palettehex_d()
: Discrete colour scale
scale_fill_palettehex_d()
: Discrete fill scale
scale_colour_palettehex_c()
: Continuous colour scale
scale_color_palettehex_c()
: Continuous colour scale
scale_fill_palettehex_c()
: Continuous fill scale
if(curl::has_internet()){
library(ggplot2)
x <- get_popular_palettes()
ggplot(mtcars, aes(mpg)) +
geom_density(aes(fill = disp, group = disp)) +
scale_fill_palettehex_c(x)
ggplot(mtcars, aes(mpg)) +
geom_density(aes(fill = disp, group = disp)) +
scale_fill_palettehex_c(x, 3)
ggplot(mtcars, aes(mpg, disp, colour = factor(cyl))) +
geom_point() +
scale_color_palettehex_d(x)
ggplot(mtcars, aes(mpg, disp, colour = factor(cyl))) +
geom_point() +
scale_color_palettehex_d(x, 1872)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.