-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path_make_pdf.qmd
147 lines (125 loc) · 2.9 KB
/
_make_pdf.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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
---
title: Best Practices for Data Visualisation
subtitle: Insights, advice, and examples (with code) to make data outputs more readable, accessible, and impactful
author: "Andreas Krause, Nicola Rennie, & Brian Tarran"
bibliography: references.bib
nocite: |
@*
format:
pdf:
toc: true
toc-depth: 2
number-sections: true
number-depth: 2
output-file: "RSS-data-vis-guide"
output-ext: "pdf"
linkcolor: RSSblue
urlcolor: RSSblue
include-in-header:
- "styles.tex"
editor: source
---
```{r}
#| echo: false
#| eval: true
process_qmd <- function(file, fpath_in = "images/", fpath_out = "images/") {
doc <- readLines(file)
end_yaml <- which(doc == "---")[2]
out_doc <- doc[seq(end_yaml+1, length(doc))]
if (fpath_in != fpath_out) {
out_doc <- stringr::str_replace_all(out_doc, fpath_in, fpath_out)
}
res <- knitr::knit_child(text = out_doc, quiet = TRUE, options = list(eval = FALSE, echo = TRUE))
return(res)
}
```
# Introduction
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
idx <- process_qmd("index.qmd")
cat(unlist(idx), sep = '\n')
```
# How to use this guide
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
howto <- process_qmd("howto.qmd")
cat(unlist(howto), sep = '\n')
```
# Why we visualise data
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
why <- process_qmd("docs/why-visualise.qmd", fpath_in = "images/", fpath_out = "docs/images/")
cat(unlist(why), sep = '\n')
```
# Principles and elements of visualisations
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
principles <- process_qmd("docs/principles.qmd", fpath_in = "images/", fpath_out = "docs/images/")
cat(unlist(principles), sep = '\n')
```
# Choosing a visualisation type
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
choosing <- process_qmd("docs/choosing.qmd", fpath_in = "images/", fpath_out = "docs/images/")
cat(unlist(choosing), sep = '\n')
```
# Styling for accessibility
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
styling <- process_qmd("docs/styling.qmd", fpath_in = "images/", fpath_out = "docs/images/")
cat(unlist(styling), sep = '\n')
```
# Styling for RSS Publications
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
tools <- process_qmd("docs/tools.qmd", fpath_in = "images/", fpath_out = "docs/images/")
cat(unlist(tools), sep = '\n')
```
# References
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
refs <- process_qmd("docs/references.qmd")
cat(unlist(refs), sep = '\n')
```
# About the authors
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
about <- process_qmd("about.qmd")
cat(unlist(about), sep = '\n')
```
# Terms and Conditions
```{r}
#| output: asis
#| echo: false
#| eval: true
#| message: false
ts_and_cs <- process_qmd("ts-and-cs.qmd")
cat(unlist(ts_and_cs), sep = '\n')
```