40

I have a rmarkdown presentation (ioslides) with 3 slides with flow diagrams worked in DiagrammeR's mermaid. The following file saved as .Rmd can reproduce the example (at least in my machine, hopefully yours too):

---
title: "Untitled"
author: "author"
date: "28 de enero de 2018"
output: ioslides_presentation
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)

require(DiagrammeR)
```

## DiagrammeR's mermaid

It's not producing consistent results in slides when using line breaks.

```{r flow}
mermaid("
  graph LR
    C(CLIENTES <br>Clients) --> D[Doctors]
    U(USUARIOS <br>Users <br>Patients <br>Nurses) --> D
    D --> S(SALIDAS <br>Medicines <br>Surgery)
    style C fill: #f5f5dc
    style D fill: #4682b4
    style U fill: #ffe4c4
")
```

## Second attempt

```{r flow2}
mermaid("
  graph LR
    C(CLIENTES <br>Clients) --> D[Doctors]
    U(USUARIOS <br>Users <br>Patients <br>Nurses) --> D
    D --> S(SALIDAS <br>Medicines <br>Surgery)

")
```

## Third attempt

```{r flow3}
mermaid("
  graph LR
    C(CLIENTES <br>Clients) --> D[Doctors]
    U(USUARIOS <br>Users <br>Patients <br>Nurses) --> D
    D --> S(SALIDAS <br>Medicines <br>Surgery)
    style C fill: #f5f5dc
    style D fill: #4682b4
    style U fill: #ffe4c4

")
```

When run, it produces two normal-sized diagrams and a small one. Things I've noticed:

  • The last chunk that gets modified (text entered or deleted, even carriage returns), gets properly displayed (if I "touch" the tree of them, normally the first one displays wrong)
  • cache = FALSE or cache = TRUE don't make a difference
  • Adding line breaks (additional) between lines of the mermaid declaration don't work (suggested as a solution here)
  • Inserting or removing the styling declarations don't make a difference
  • Browser used doesn't make a difference (initially viewed with RStudio browser, but if seen in firefox the display is similarly wrong)
  • When presentation output ioslides is changed to slidy, it works (that's my alternative, but I'd rather prefer ioslides if there's a solution).

Relevant parts or R.Version and Sys.info:

> Sys.info()
                                     sysname 
                                     "Linux" 
                                     release 
                             "4.9.0-5-amd64" 
                                     version 
"#1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04)" 
                                    nodename 
                                     "pavos" 
                                     machine 
                                    "x86_64" 
## R and packages Versions
> R.Version()

$`svn rev`
[1] "73796"

$version.string
[1] "R version 3.4.3 (2017-11-30)"

$nickname
[1] "Kite-Eating Tree"

> packageVersion("DiagrammeR")
[1] ‘0.9.2’
> packageVersion("rmarkdown")
[1] ‘1.8’

What I expect: a consistently displayed presentation with fully sized and properly colored diagrams in all slides in ioslides output.

Thanks

Limey
  • 10,234
  • 2
  • 12
  • 32
PavoDive
  • 6,322
  • 2
  • 29
  • 55

2 Answers2

1

There is no problem with DiagrammeR v. 1.0.6 and rmarkdown v. 2.16. If rerun the code indicated you will get expected output:

---
title: "Test ioslides"
author: "Noname"
date: "26 january 2021"
output: ioslides_presentation
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
require(DiagrammeR)
```

## DiagrammeR's mermaid

Produce consistent results

```{r flow}
mermaid("
  graph LR
    C(CLIENTES <br>Clients) --> D[Doctors]
    U(USUARIOS <br>Users <br>Patients <br>Nurses) --> D
    D --> S(SALIDAS <br>Medicines <br>Surgery)
    style C fill: #f5f5dc
    style D fill: #4682b4
    style U fill: #ffe4c4
")
```

Output: Mermaid & DiagrammeR

Artem
  • 3,304
  • 3
  • 18
  • 41
-1

This is actually a response for your Geo Question, but I don't have enough rep on that stack to post it there

It's really weird that there are gravitational anomalies near the locations you pointed out near 6°N 85°55'W

Check out the NASA Grace Data for those locations https://gracefo.jpl.nasa.gov/data/grace-fo-data/

Orrbifold
  • 74
  • 5