theme_apa: Format ggplot2 figures in APA style

Description Usage Arguments Details Author(s) References See Also Examples

Description

theme_apa() is designed to work like any other complete theme from ggplot. To the extent possible, it aligns with the (vague) APA figure guidelines.

Usage

1
2
3
4
theme_apa(legend.pos = "right", legend.use.title = FALSE,
  legend.font.size = 12, x.font.size = 12, y.font.size = 12,
  facet.title.size = 12, remove.y.gridlines = TRUE,
  remove.x.gridlines = TRUE)

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.

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.

Details

This function 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.

Author(s)

Jacob Long <[email protected]>

References

American Psychological Association. (2010). Publication manual of the American Psychological Association, Sixth Edition. Washington, DC: American Psychological Association.

Nicol, A.A.M. & Pexman, P.M. (2010). Displaying your findings: A practical guide for creating figures, posters, and presentations, Sixth Edition. Washington, D.C.: American Psychological Association.

See Also

ggplot, theme

Examples

1
2
3
4
5
6
7
# Create plot with ggplot2
library(ggplot2)
plot <- ggplot(mpg, aes(cty, hwy)) +
  geom_jitter()

# Add APA theme with defaults
plot + theme_apa()

Example output



jtools documentation built on May 2, 2019, 11:06 a.m.