SPSS Palette Function (for ggplot2 Scales)

Description

Returns a palette function suitable for use with ggplot2 discrete scales. This is the function factory used internally by scale_color_SPSS() and scale_fill_SPSS().

Usage

SPSS_pal(version = "modern", direction = 1)

Arguments

version Character. “modern” (default) or “legacy”.
direction Integer. 1 (default) for normal order, -1 for reversed.

Value

A function that takes integer n and returns a character vector of n hex color codes.

Examples

library("psych350lab")

pal_fn <- SPSS_pal()
pal_fn(3)
[1] "#1192E8" "#005D5D" "#9F1853"
pal_fn_rev <- SPSS_pal(direction = -1)
pal_fn_rev(3)
[1] "#9F1853" "#005D5D" "#1192E8"