mdthemes icon indicating copy to clipboard operation
mdthemes copied to clipboard

Markdown Themes for 'ggplot2'

mdthemes

R build
status CRAN
Version Total
Downloads Lifecycle
Status

Overview

{mdthemes} adds support for rendering text as markdown to your favorite {ggplot2} themes thanks to the awesome {ggtext} package.

Installation

The package is available from CRAN.

install.packages("mdthemes")

Alternatively, you can install the latest development version from GitHub.

if (!requireNamespace("remotes", quietly = TRUE)) {
  install.packages("remotes")
}
remotes::install_github("thomas-neitmann/mdthemes", upgrade = "never")

Usage

Currently, {mdthemes} contains all themes from {ggplot2}, {ggthemes}, {hrbrthemes}, {tvthemes} and {cowplot} with support for rendering text as markdown. All themes start with md_ followed by the name of the original theme, e.g. md_theme_bw().

library(ggplot2)
library(mdthemes)
data(mtcars)

p <- ggplot(mtcars, aes(hp, mpg)) +
  geom_point() +
  labs(
    title = "This is a **bold** title",
    subtitle = "And an *italics* subtitle",
    x = "**_hp_**",
    caption = "<span style = 'color:blue'>A blue caption</span>"
  )

p + theme_minimal()
p + md_theme_minimal()

p + ggthemes::theme_fivethirtyeight()
p + md_theme_fivethirtyeight()

Going further

To learn more about {mdthemes} check out this blog post accompanying the first CRAN release.