scale_color_ku | R Documentation |
Construct ggplot2 scale with KU color palette
scale_color_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, y = mpg, color = cyl) + ggplot2::geom_point(size = 2) + scale_color_ku("cat3_ext", name = "Number of cylinders") + ggplot2::xlab("Mass / 1000 lb") + ggplot2::ylab("Fuel efficiency / mpg") + ggplot2::ggtitle( label = "Fuel efficiency versus mass and number of cylinders", subtitle = "Example of scale_color_ku()" ) + ggplot2::theme_minimal() + ggplot2::theme( plot.title = ggtext::element_markdown(lineheight = 1.1), plot.subtitle = ggtext::element_markdown(lineheight = 1.1) ) } # scale_color_ku <- paletti::get_scale_color(paletti::get_pal(ku_palettes)) # FIXME: Temporary hack to get around where dots are passed.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.