Construct ggplot2 scale with KU color palette
scale_color_ku(palette = "full", discrete = TRUE, reverse = FALSE, ...)character. one of the names in ku_palettes
boolean. FALSE implies a continuous
palette.
boolean. whether to reverse the order
additional arguments passed to
discrete_scale() or scale_color_gradientn() when
discrete is TRUE or FALSE, respectively.
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.