Skip to content

Commit 548263f

Browse files
committed
diagram fixes
1 parent f9f2df0 commit 548263f

6 files changed

+50
-2837
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
*.pdf binary
88
*.html binary
99
*.epub binary
10+
*.svg binary

10-environment_diagram.Rmd

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
output:
3+
pdf_document: default
4+
html_document: default
5+
---
16
# Mapping your local environment (10)
27

38
```{r setup, echo=FALSE, message=FALSE, warning=FALSE}
@@ -168,9 +173,27 @@ digraph Envgraph {
168173
[5]: paste0(linux_lbl, ':\\n', linux_ver)
169174
[6]: paste0('PostgreSQL:\\n', postgres_ver)
170175
[7]: cli
171-
")
176+
") %>%
177+
DiagrammeRsvg::export_svg() %>%
178+
cat(file = "diagrams/envgraph.svg")
179+
180+
# convert to PDF and PNG - LaTeX doesn't read SVGs by default
181+
magick::image_read_svg("diagrams/envgraph.svg") %>%
182+
magick::image_write(
183+
path = "diagrams/envgraph.pdf",
184+
format = "pdf"
185+
)
186+
magick::image_read_svg("diagrams/envgraph.svg") %>%
187+
magick::image_write(
188+
path = "diagrams/envgraph.png",
189+
format = "png"
190+
)
172191
```
173192

193+
```{r echo=FALSE}
194+
# display the PNG/PDF - this works in both HTML and PDF
195+
knitr::include_graphics("diagrams/envgraph.png", auto_pdf = TRUE)
196+
```
174197

175198
## Communicating with Docker Applications
176199

22-drilling-into-db-environment.Rmd

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,29 @@ graph <-
382382
nodes_df = table_nodes_ndf,
383383
edges_df = fk_edf,
384384
graph_name = 'Simple FK Graph'
385-
)
385+
)
386+
387+
# export the widget to an SVG file
388+
render_graph(graph) %>%
389+
DiagrammeRsvg::export_svg() %>%
390+
cat(file = "diagrams/fkgraph.svg")
391+
392+
# convert to PDF and PNG - LaTeX doesn't read SVGs by default
393+
magick::image_read("diagrams/fkgraph.svg") %>%
394+
magick::image_write(
395+
path = "diagrams/fkgraph.pdf",
396+
format = "pdf"
397+
)
398+
magick::image_read_svg("diagrams/fkgraph.svg") %>%
399+
magick::image_write(
400+
path = "diagrams/fkgraph.png",
401+
format = "png"
402+
)
403+
```
386404

387-
# View the graph
388-
render_graph(graph)
405+
```{r echo=FALSE}
406+
# display the PNG/PDF - this works in both HTML and PDF
407+
knitr::include_graphics("diagrams/fkgraph.png", auto_pdf = TRUE)
389408
```
390409

391410
```{r}

diagrams/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.svg
2+
*.png
3+
*.pdf

diagrams/potential_architectures.html

Lines changed: 0 additions & 2833 deletions
This file was deleted.

diagrams/potential_architectures.pdf

-45 KB
Binary file not shown.

0 commit comments

Comments
 (0)