ggplot-themes: Steve's Preferred 'ggplot2' Themes and Assorted Stuff

theme_steveR Documentation

Steve's Preferred ggplot2 Themes and Assorted Stuff

Description

theme_steve() was a preferred theme of mine a few years ago. It is basically theme_bw() from ggplot2 theme, but with me tweaking a few things. I've since moved to theme_steve_web() for most things now, prominently on my website. It incorporates the "Open Sans" and "Titillium Web" fonts that I like so much. post_bg() is for changing the backgrounds on plots to better match my website for posts that I write. theme_steve_ms() is for LaTeX manuscripts that use the cochineal font package. theme_steve_font() is for any purpose, allowing you to supply your own font.

Usage

theme_steve(...)

theme_steve_web(...)

post_bg(...)

theme_steve_ms(axis_face = "italic", caption_face = "italic", ...)

theme_steve_font(axis_face = "italic", caption_face = "italic", font, ...)

Arguments

...

optional stuff, but don't put anything in here. You won't need it.

axis_face

font face ("plain", "italic", "bold", "bold.italic"). Optional, defaults to "italic". Applicable only to theme_steve_ms().

caption_face

font face ("plain", "italic", "bold", "bold.italic"). Optional, defaults to "italic". Applicable only to theme_steve_ms().

font

font family for the plot. Applicable only to theme_steve_font().

Details

theme_steve_web() depends on having the fonts installed on your end. It's ultimately optional for you to have them.

Value

post_bg() takes a ggplot2 plot and changes the background to have a color of "#fdfdfd". theme_steve() takes a ggplot2 plot and formats it to approximate theme_bw() from ggplot2, but with some other tweaks. theme_steve_web() extends theme_steve() to add custom fonts, notably "Open Sans" and "Titillium Web". In all cases, these functions take a ggplot2 plot and return another ggplot2 plot, but with some cosmetic changes. theme_steve_ms() takes a ggplot2 plot and overlays "Crimson Text" fonts, which is the basis of the cochineal font package in LaTeX. theme_steve_font() takes a ggplot2 plot and overlays a font of your choosing.

See Also

ggplot2::theme

Examples

## Not run: 
library(ggplot2)

ggplot(mtcars, aes(x = mpg, y = hp)) +
  geom_point() + theme_steve() +
  labs(title = "A ggplot2 Plot from the Motor Trend Car Road Tests Data",
  subtitle = "We've all seen this plot over a hundred times.",
  caption = "Data: ?mtcars in {datasets} in base R.")

ggplot(mtcars, aes(x = mpg, y = hp)) +
  geom_point() + theme_steve_web() +
  labs(title = "A ggplot2 Plot from the Motor Trend Car Road Tests Data",
  subtitle = "Notice the prettier fonts, if you have them.",
  caption = "Data: ?mtcars in {datasets} in base R.")

ggplot(mtcars, aes(x = mpg, y = hp)) +
  geom_point() + theme_steve_web() +
  post_bg() +
  labs(title = "A ggplot2 Plot from the Motor Trend Car Road Tests Data",
  subtitle = "Notice the slight change in background color",
  caption = "Data: ?mtcars in {datasets} in base R.")

ggplot(mtcars, aes(x = mpg, y = hp)) +
  geom_point() + theme_steve_ms() +
  labs(title = "A ggplot2 Plot from the Motor Trend Car Road Tests Data",
  subtitle = "Notice the fonts will match the 'cochineal' font package in LaTeX.",
  caption = "Data: ?mtcars in {datasets} in base R.")

ggplot(mtcars, aes(x = mpg, y = hp)) +
  geom_point() + theme_steve_font(font = "Comic Sans MS") +
  labs(title = "A ggplot2 Plot from the Motor Trend Car Road Tests Data",
  subtitle = "Notice that this will look ridiculous",
  caption = "Data: ?mtcars in {datasets} in base R.")

## End(Not run)

stevemisc documentation built on April 12, 2022, 5:06 p.m.