Learn R Programming

mdthemes (version 0.1.0)

as_md_theme: Turn a Usual Theme into a Markdown Theme

Description

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

Usage

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

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab