-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.rmd
71 lines (50 loc) · 2.14 KB
/
README.rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
title: "mdthemes"
output: github_document
---
```{r, include=FALSE}
knitr::opts_chunk$set(
fig.path = "man/figures/README-"
)
```
[![R build status](https://github.com/thomas-neitmann/mdthemes/workflows/R-CMD-check/badge.svg)](https://github.com/thomas-neitmann/mdthemes/actions)
[![CRAN Version](https://www.r-pkg.org/badges/version/mdthemes?color=green)](https://cran.r-project.org/package=mdthemes)
[![Total Downloads](http://cranlogs.r-pkg.org/badges/grand-total/mdthemes?color=green)](https://cran.r-project.org/package=mdthemes)
[![Lifecycle Status](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
## 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.
```r
install.packages("mdthemes")
```
Alternatively, you can install the latest development version from GitHub.
```r
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()`.
```{r examples, message=FALSE, warning=FALSE, fig.show='hold', out.width='50%'}
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()
```
```{r examples_cont, fig.show='hold', out.width='50%'}
p + ggthemes::theme_fivethirtyeight()
p + md_theme_fivethirtyeight()
```
## Going further
To learn more about `{mdthemes}` check out [this blog post](https://thomasadventure.blog/posts/mdthemes-is-on-cran-markdown-powered-themes-for-ggplot2/) accompanying the first CRAN release.