prism_fill_pal: Prism fill palettes

View source: R/prism_fill_pal.R

prism_fill_palR Documentation

Prism fill palettes

Description

A collection of fill palettes which mirror the colour schemes available in GraphPad Prism.

Usage

prism_fill_pal(palette = "colors")

Arguments

palette

string. Palette name, see lengths(ggprism_data$fill_palettes) for valid palette names.

Value

Returns a function which takes a single integer as its only argument and returns a character vector of hexadecimal colours. See the examples below for usage.

Examples

library(ggplot2)

## list all available fill palettes and their lengths
lengths(ggprism_data$fill_palettes)

## select some colours from a palette
prism_fill_pal(palette = "summer")(4)

## see all the colours in a specific palette
# define a function for convenience
library(scales)

show_palette <- function(palette) {
  scales::show_col(
    prism_fill_pal(palette = palette)(
      attr(prism_fill_pal(palette = palette), "max_n")
    )
  )
}

# show the colours in the palette "pearl"
show_palette("floral")

ggprism documentation built on Nov. 4, 2022, 5:08 p.m.