themeApaRaw: APA theme for ggplot2 objects based on 'jtools::theme_apa'

Description Usage Arguments Details

View source: R/themeApa.R

Description

Set a APA theme and additional options to a graph like other themes, graph + themeApaRaw().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
themeApaRaw(
  legend.pos = getGraphOption("legend.position"),
  legend.use.title = FALSE,
  legend.font.size = getGraphOption("axis.title.cex"),
  font.size = getGraphOption("fontsize"),
  x.font.size = getGraphOption("fontsize"),
  y.font.size = getGraphOption("fontsize"),
  facet.title.size = getGraphOption("fontsize"),
  remove.y.gridlines = TRUE,
  remove.x.gridlines = TRUE,
  family = getGraphOption("family"),
  axisTickLength = getGraphOption("axisTickLength"),
  axisTickWidth = getGraphOption("axisTickWidth")
)

Arguments

legend.pos

One of "right", "left", "top", "bottom", "topleft", "topright", "topmiddle", "bottomleft", "bottomright", or "bottommiddle". Positions the legend, which will layer on top of any geoms, on the plane.

legend.use.title

Logical. Specify whether to include a legend title. Defaults to FALSE.

legend.font.size

Integer indicating the font size of the labels in the legend. Default and APA-recommended is 12, but if there are many labels it may be necessary to choose a smaller size.

font.size

General font size.

x.font.size

Font size of x-axis label.

y.font.size

Font size of x-axis label.

facet.title.size

Font size of facet labels.

remove.y.gridlines

Should the coordinate grid on the y-axis (horizontal lines) be removed? Default is TRUE.

remove.x.gridlines

Should the coordinate grid on the x-axis (vertical lines) be removed? Default is TRUE.

family

global font family.

axisTickLength

length of axis ticks.

axisTickWidth

width of axis ticks.

Details

This function is a modification of jtools::theme_apa that applies a theme to ggplot2 figures with a style that is roughly in line with APA guidelines. Users may need to perform further operations for their specific use cases.

There are some things to keep in mind about APA style figures:

Because APA style calls for positioning legends on the plane itself, this function includes options for choosing a position–top left, top right, bottom left, bottom right–to place the legend. ggplot2 provides no obvious way to automatically choose a position that overlaps least with the geoms (the plotted data), so users will need to choose one.

Facetting is supported, but APA guidelines are considerably less clear for such situations.

This theme was created with inspiration from Rudolf Cardinal's code, which required updating for newer versions of ggplot2 and adaptations for APA style.


vandenman/JASPgraphs documentation built on Dec. 16, 2021, 5:37 p.m.