theme_apa: APA-style 'ggplot2' Theme

View source: R/theme_apa.R

theme_apaR Documentation

APA-style ggplot2 Theme

Description

ggplot2 theme with a white panel background, no grid lines, large axis and legend titles, and increased text padding for better readability.

Usage

theme_apa(base_size = 12, base_family = "", box = FALSE)

Arguments

base_size

Numeric. Base font size; other font sizes and margins are adjusted relative to this.

base_family

Character. Base font family.

box

Logical. Indicates whether to draw a black panel border.

Value

Object of class theme and gg, see ggplot2::theme().

See Also

ggplot2::theme_bw(), ggplot2::theme()

Examples

 
   # Copied from ?ggtheme
   mtcars2 <- within(mtcars, {
   vs <- factor(vs, labels = c("V-shaped", "Straight"))
   am <- factor(am, labels = c("Automatic", "Manual"))
   cyl  <- factor(cyl)
   gear <- factor(gear)
   })

   library("ggplot2")
   p1 <- ggplot(mtcars2) +
     geom_point(aes(x = wt, y = mpg, colour = gear)) +
     labs(
       title = "Fuel economy declines as weight increases",
       subtitle = "(1973-1974)",
       x = "Weight (1000 lbs)",
       y = "Fuel economy (mpg)",
       colour = "Gears"
     )

   p1
   p1 + theme_apa()
 

papaja documentation built on Oct. 30, 2024, 9:09 a.m.