-
Notifications
You must be signed in to change notification settings - Fork 4
/
README.Rmd
94 lines (60 loc) · 2.84 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
output: github_document
---
# dscstyle <img src='man/figures/logo.png' align="right" height="120" />
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
<!-- badges: end -->
The goal of `dscstyle` is to provide a unified style for the [DSC-WAV project](https://dsc-wav.github.io/www/).
## Installation
You can install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("DSC-WAV/dscstyle")
```
## DSC Color Palettes
The package **dscstyle** includes three color palettes that are colorblind friendly and look good with the DSC-WAV logo. These palettes are available in the two **ggplot2** scale functions:
+ `scale_color_dsc()`
+ `scale_fill_dsc()`
These scale functions default to a dark color palette (`palette="dark"`). There is also a lighter palette option (`palette="light"`) that can be included in these functions, as well as a palette for ordered data (`palette="blues"`).
**Dark Palette**
![Dark Palette](man/figures/dark-palette.png)
**Light Palette**
![Light Palette](man/figures/light-palette.png)
**Blues Palette**
![Blues Palette](man/figures/blues-palette.png)
## DSC **ggplot2** Theme
There is also a **ggplot2** theme included in the **dscstyle** package:
+ `theme_dsc()`
This uses the Google font Oswald in to format text. To use this requires the **showtext** package. While using `theme_dsc()` will render correctly when knitting to an HTML document, unfortunately, it will not render in the RStudio viewer.
Additionally, you will need to set the chunk option for your plot to include `fig.showtext=TRUE`.
## Example
```{r example, fig.showtext=TRUE}
library(dscstyle)
library(ggplot2)
# Load the Oswald font
sysfonts::font_add_google("Oswald", "Oswald")
ggplot(data = iris, aes(x = Sepal.Length, fill = Species)) +
geom_histogram() +
theme_dsc() +
scale_fill_dsc()
```
## Rmarkdown DSC Evaluation Report Template
The **dscstyle** package also includes a report template to style HTML rendered evaluation reports.
- In RStudio, navigate to `File > New File > R Markdown...`
- Select `From Template`
- Select the **DSC Evaluation Report** from the template options
- Give the RMD file a name
- Click `OK`
![RMD Report](man/figures/eval-report.png)
You may need to install the **showtext** package prior to the first time you use this template. This allows the Oswald Google font to be used in the plots.
This template sets many global knitr options including `fig.showtext=TRUE`, so that they do not have to be included in each chunk.