Add ability to render text as markdown within theme
add_md.RdAdapted from {mdthemes} function to provide option to render text as markdown within {ggplot2} theme
Examples
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
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
# Text is rendered properly
p + add_md(theme_emw)
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.