theme_SPSS: Plot theme to mimic the look of SPSS graphs

View source: R/ggplot2.R

theme_SPSSR Documentation

Plot theme to mimic the look of SPSS graphs

Description

Complete theme that controls all non-data display of a plot to mimic the look of SPSS graphs. Use theme after theme_SPSS to further tweak the display.

Usage

theme_SPSS(
  base_size = 12,
  base_family = "",
  base_line_size = 0.5,
  base_rect_size = 0.5,
  version = r2spss_options$get("version"),
  scales = NULL,
  scale.x = scales,
  scale.y = scales
)

Arguments

base_size

an integer giving the base font size in pts.

base_family

a character string giving the base font family.

base_line_size

base size for line elements.

base_rect_size

base size for borders of rectangle elements.

version

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

scales, scale.x, scale.y

a character string specifying whether both or each of the axes are expected to be continuous ("continuous") or discrete ("discrete"). Note that this only controls the appearance of the tick labels on the axis, as the theme has no control over the information that is displayed in the plot. SPSS displays larger tick labels a for discrete axis than for a continuous axis, hence specifying this information in the theme adjusts the tick label size accordingly. The default (NULL) means that the tick labels are of the same size as for a continuous axis.

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


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