scale_fill_ku | R Documentation |
Construct ggplot2 scale with KU color palette
scale_fill_ku(palette = "full", discrete = TRUE, reverse = FALSE, ...)
palette |
character. one of the names in ku_palettes |
discrete |
boolean. |
reverse |
boolean. whether to reverse the order |
... |
additional arguments passed to
|
ggplot2 scale
if (base::interactive()) { library(dplyr) library(ggplot2) library(magrittr) mtcars %>% dplyr::mutate(cyl = base::factor(cyl, levels = c("4", "6", "8"), ordered = TRUE)) %>% ggplot2::ggplot() + ggplot2::aes(x = wt, fill = cyl) + ggplot2::geom_histogram(bins = 6) + scale_fill_ku("cat3_ext", name = "Number of cylinders") + ggplot2::scale_y_continuous(breaks = base::seq.int(0L, 12L, by = 2L)) + ggplot2::xlab("Mass / 1000 lb") + ggplot2::ylab("Frequency") + ggplot2::ggtitle( label = "Fuel efficiency versus mass and number of cylinders", subtitle = "Example of scale_fill_ku()" ) + ggplot2::theme_minimal() + ggplot2::theme( plot.title = ggtext::element_markdown(lineheight = 1.1), plot.subtitle = ggtext::element_markdown(lineheight = 1.1) ) } # scale_fill_ku <- paletti::get_scale_fill(paletti::get_pal(ku_palettes))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.