-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.qmd
More file actions
85 lines (70 loc) · 1.86 KB
/
template.qmd
File metadata and controls
85 lines (70 loc) · 1.86 KB
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
---
title: "Title"
subtitle: "Subtitle"
author: "Markus Ostarek"
date: today
# institute: "Social Change Lab"
format:
scl-revealjs: default
execute:
# cache: true
# freeze: auto
warning: false
echo: true
---
# Getting Started
## Using reveal.js
- https://quarto.org/docs/presentations/revealjs/
## Load Packages
```{r setup}
#| echo: true
#| output: false
library(tidyverse)
```
```{r theme}
#| eval: true
#| echo: false
scl_colors <- c("logo" = "#3653C8", "font" = "#243937", "#0B2E6E", "#0F4AB2")
theme_scl <- function(
base_size = 12,
base_family = "",
plot_title_size = 20,
plot_title_color = scl_colors["logo"]) {
ggplot2::theme_minimal(base_size = base_size, base_family = base_family) +
theme(
plot.background = element_rect(colour = "white"), # removed by minimal
text = element_text(color = "black"),
axis.text = element_text(color = "black"), # break labels
axis.title = element_text(color = "black", size = base_size), # axis labels
axis.line = element_line(),
legend.text = element_text(color = "black"),
plot.title = element_text(color = plot_title_color),
plot.caption = element_text(color = scl_colors["font"], size = 9, hjust = 0)
)
}
ggplot2::theme_set(theme_grey()) # default
```
# Some Results
## Plot
- classic `ggplot2` example with custom `theme_scl()` function
## Plot
```{r plot}
#| echo: false
#| fig-align: center
#| fig-width: 11
#| fig-height: 6
mpg %>%
ggplot(aes(x = displ, y = hwy)) +
geom_point(aes(color = class)) +
geom_smooth(color = scl_colors["logo"]) +
# paletteer::scale_color_paletteer_d("colorblindr::OkabeIto_black") +
theme_scl() +
labs(
title = "Plot Example",
subtitle = "Plot Subtitle",
x = "Engine displacement",
y = "Highway miles per gallon",
color = "Class",
caption = "Data: EPA, Graphic: socialchangelab.org"
)
```