R/more_colors.R

Defines functions more_colors

Documented in more_colors

#' Use a palette with 24 colors
#'
#' \code{more_colors} helps users to build a more robust palette serving ggplot objects.
#'
#' @param n the max number of color you choose
#' @return The vector of the colors you choose
#' @author Jiaxiang Li
#'
#' @import RColorBrewer
#' @importFrom utils head
#' @export
#' @examples
#' more_colors(n = 12)
#' more_colors(n = 24)
#' more_colors(n = 36)

more_colors <- function(n = 24){
    c(
        RColorBrewer::brewer.pal(12,'Paired'),
        RColorBrewer::brewer.pal(12,'Set3')
    ) %>%
        head(n)
}

Try the add2ggplot package in your browser

Any scripts or data that you put into this service are public.

add2ggplot documentation built on Feb. 7, 2020, 5:09 p.m.