viz_palette: Show a single palette

View source: R/utils.R

viz_paletteR Documentation

Show a single palette

Description

Display a single palette to see whether it meets your needs. If no num parameter is given, all the colours in the palette will be displayed. If num is less than the number of colours in the palette, then only the first num colours will be displayed. If num is greater than the number of colours in the palette, then that many colours will be generated by linear interpolation over the vector of colours in the chosen palette.

Usage

viz_palette(pal, ttl = deparse(substitute(pal)), num = length(pal))

Arguments

pal

character, vector of (hexadecimal) colours representing a palette

ttl

character, title to be displayed (the name of the palette)

num

numeric, the number of colours to display

Value

A vector of colors from a single palette

Examples

viz_palette(vangogh_palettes$StarryNight)
viz_palette(vangogh_palettes$StarryNight, "StarryNight")
viz_palette(vangogh_palettes$StarryNight, "StarryNight first 4", num = 4)
viz_palette(vangogh_palettes$StarryNight, "StarryNight interpolated to 25", num = 25)

vangogh documentation built on May 27, 2022, 9:12 a.m.