Skip to content

Commit 163373b

Browse files
committed
add DiagrammeR to Suggests and handle within vignette
1 parent a397949 commit 163373b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

DESCRIPTION

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Suggests:
5151
covr,
5252
cramer,
5353
DiagrammeR,
54+
DiagrammeRsvg,
5455
extraDistr,
5556
fields,
5657
ggplot2,
@@ -73,7 +74,7 @@ Config/testthat/edition: 3
7374
Encoding: UTF-8
7475
Language: en-GB
7576
Roxygen: list(markdown = TRUE)
76-
RoxygenNote: 7.3.0
77+
RoxygenNote: 7.3.1
7778
SystemRequirements: Python (>= 2.7.0) with header files and shared
7879
library; TensorFlow (v1.14; https://www.tensorflow.org/); TensorFlow
7980
Probability (v0.7.0; https://www.tensorflow.org/probability/)

vignettes/get_started.Rmd

+5-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (!file.exists("figures"))
2525
file.copy("../man/figures/plotlegend.png",
2626
"figures/plotlegend.png")
2727
28-
diagrammer_installed <- requireNamespace("DiagrammeR", quietly = TRUE)
28+
diagrammer_svg_installed <- requireNamespace("DiagrammeRsvg", quietly = TRUE)
2929
```
3030

3131
## Installation
@@ -386,7 +386,8 @@ greta provides a plot function for greta models to help you visualise and check
386386
```{r plot, eval = FALSE}
387387
plot(m)
388388
```
389-
```{r plot_hidden, echo = FALSE, eval = diagrammer_installed}
389+
390+
```{r plot_hidden, echo = FALSE, eval = diagrammer_svg_installed}
390391
gr <- plot(m)
391392
DiagrammeR::export_graph(attr(gr, "dgr_graph"),
392393
file_name = "figures/full_graph.png",
@@ -407,7 +408,7 @@ The fourth type of node (diamonds) represents probability distributions. These h
407408

408409
For example, a plot of just the prior distribution over `coef` (defined as `coef <- normal(0, 3)`) shows the parameters as data leading into the normal distribution, and a dashed arrow leading out to the distribution's value, the variable `coef`:
409410

410-
```{r plot_coef, echo = FALSE, eval = diagrammer_installed}
411+
```{r plot_coef, echo = FALSE, eval = diagrammer_svg_installed}
411412
coef <- normal(0, 3)
412413
m_coef <- model(coef)
413414
gr <- plot(m_coef)
@@ -421,7 +422,7 @@ DiagrammeR::export_graph(attr(gr, "dgr_graph"),
421422

422423
It's the same for the model likelihood, but this time the distribution's parameters are a variable (`sd`) and the result of an operation (`mean`), and the distribution's value is given by data (the observed sepal lengths `y`):
423424

424-
```{r plot_likelihood, echo = FALSE, eval = diagrammer_installed}
425+
```{r plot_likelihood, echo = FALSE, eval = diagrammer_svg_installed}
425426
sd <- variable()
426427
y <- as_data(iris$Sepal.Length)
427428
mean <- ones(150)

0 commit comments

Comments
 (0)