palette_SPSS: SPSS Color Palette and Color Scales

View source: R/ggplot2.R

palette_SPSSR Documentation

SPSS Color Palette and Color Scales


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.


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)

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

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

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



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


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


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.


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").


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.


Andreas Alfons


# 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) +

# 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")

r2spss documentation built on May 25, 2022, 5:05 p.m.