-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
44 lines (32 loc) · 1.15 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
---
title: "README"
output: github_document
---
# Overview
`cplthemes` is an R package to construct visualizations in accordance with CPL's style guide. Currently, the package supports basic `ggplot` visualizations. The package is inspired by the excellent Urban Institute's [`urbnthemes`](https://github.com/UrbanInstitute/urbnthemes) package.
# Installation
```
install.packages("devtools")
devtools::install_github("californiapolicylab/cplthemes")
```
```{r, message=FALSE, warning=FALSE, echo=FALSE}
devtools::install_github("californiapolicylab/cplthemes")
```
# Usage
For detailed usage see the [CPL design guide documentation](https://californiapolicylab.github.io/cpl_design_guide/).
```{r, warning=FALSE,message=FALSE}
library(tidyverse)
library(cplthemes)
cpl_set_theme()
mtcars %>%
count(cyl) %>%
ggplot(mapping = aes(x = factor(cyl), y = n)) +
geom_col(width = 0.5) +
geom_text(mapping = aes(label = n), vjust = -0.5) +
scale_y_continuous(expand = expansion(mult = c(0.002, 0)),
limits = c(0, 15)) +
labs(x = "Cylinders",
y = NULL,
subtitle = "Number of Cars") +
theme(plot.title.position = "plot")
```