palette_SPSS {r2spss}R Documentation

SPSS Color Palette and Color Scales

Description

Color palette used by SPSS, and discrete color scales to be used in plots (e.g., for multiple lines in a plot) to mimic the look of SPSS graphs.

Usage

palette_SPSS(n = NULL, version = r2spss_options$get("version"))

paletteSPSS(n = NULL, version = r2spss_options$get("version"))

SPSS_pal(version = r2spss_options$get("version"), direction = 1)

scale_color_SPSS(
  ...,
  version = r2spss_options$get("version"),
  direction = 1,
  aesthetics = "color"
)

scale_colour_SPSS(
  ...,
  version = r2spss_options$get("version"),
  direction = 1,
  aesthetics = "colour"
)

scale_fill_SPSS(
  ...,
  version = r2spss_options$get("version"),
  direction = 1,
  aesthetics = "fill"
)

Arguments

n

an integer giving the number of colors to select from the palette. If NULL (the default), all colors of the palette are returned.

version

a character string specifying whether to use the color palette of recent SPSS versions ("modern") or older versions (<24; "legacy").

direction

an integer giving the direction to travel through the palette. Possible values are 1 for forward (the default) and -1 for backward.

...

additional arguments to be passed to discrete_scale.

aesthetics

a character string or vector listing the names of the aesthetics with which the scale works. For example, color settings can be applied to the color and fill aesthetics by supplying c("color", "fill").

Value

palette_SPSS returns a character vector specifying up to 30 colors as used by SPSS.

SPSS_pal returns a function that generates colors from the specified SPSS color palette, in the specified direction. It is mainly used internally by the discrete color scales.

scale_color_SPSS, scale_colour_SPSS, and scale_fill_SPSS return a discrete color scale to be added to plots.

Author(s)

Andreas Alfons

Examples

# data to be plotted
df <- data.frame(x = 1:30, y = 0)

# initialize plot
p <- ggplot(aes(x = x, y = y, fill = factor(x)), data = df) +
  geom_point(shape = 21, size = 3, show.legend = FALSE) +
  theme_SPSS()

# colors of modern SPSS versions
p + theme_SPSS() + scale_fill_SPSS()

# colors of legacy SPSS versions
p + theme_SPSS(version = "legacy") +
  scale_fill_SPSS(version = "legacy")


[Package r2spss version 0.3.2 Index]