as_md_theme: Turn a Usual Theme into a Markdown Theme

Description Usage Arguments Value Examples

View source: R/as_md_theme.R

Description

Transform any {ggplot2} theme into a theme that renders text as markdown

Usage

1
as_md_theme(theme, all_plain = TRUE)

Arguments

theme

An object of class theme

all_plain

logical. Should all text be plain by default?

Value

An object of class theme that can be added to any ggplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(ggplot2)
data(mtcars)

# Create a custom theme
my_theme <- theme_gray() +
  theme(
    panel.grid.minor = element_blank(),
    panel.grid.major = element_blank()
  )
p <- ggplot(mtcars, aes(hp)) +
  geom_histogram() +
  ggtitle("Mixing **bold** and *italics* is easy")

# Text is not rendered
p + my_theme

# Text is rendered properly
p + as_md_theme(my_theme)

mdthemes documentation built on July 1, 2020, 9:08 p.m.