-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy path_setup.qmd
61 lines (52 loc) · 1.71 KB
/
_setup.qmd
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
```{r setup}
#| cache: FALSE
library(dplyr)
library(tidyr)
library(readr)
library(stringr)
library(forcats)
library(purrr)
library(ggplot2)
library(ggthemes)
library(glue)
library(knitr)
set.seed(42)
knitr::opts_template$set(
code = list(echo = TRUE, eval = FALSE)
)
# load font for plots
.font <- "Source Sans Pro"
if (!(.font %in% sysfonts::font_families()))
sysfonts::font_add_google(.font, .font)
showtext::showtext_auto()
# set custom plot theme
theme_set(theme_bw(base_size = 14, base_family = .font))
theme_update(panel.grid = element_blank(),
strip.background = element_blank(),
legend.key = element_blank(),
panel.border = element_blank(),
axis.line = element_line(),
strip.text = element_text(face = "bold"))
# set options for default color and fill scales
options("ggplot2.discrete.colour" = ggthemes::scale_colour_ptol )
options("ggplot2.continuous.colour" = viridis::scale_colour_viridis)
options("ggplot2.discrete.fill" = ggthemes::scale_fill_ptol )
options("ggplot2.continuous.fill" = viridis::scale_fill_viridis )
# solarized colors for individual elements (like reference lines)
pal <- list(
grey = "#93a1a1",
red = "#dc322f",
blue = "#268bd2",
purple = "#6c71c4"
)
# from https://bookdown.org/yihui/rmarkdown-cookbook/font-color.html
colorize <- function(x, color) {
if (knitr::is_latex_output()) {
glue("\\textcolor{<color>}{<x>}", .open = "<", .close = ">")
} else if (knitr::is_html_output()) {
glue("<span style='color: var(--{stringr::str_sub(color, 2)});'>{x}</span>")
} else x
}
# refs <- suppressMessages(bibtex::read.bib("experimentology.bib"))
# ref <- \(key) capture.output(print(refs[key]))
```