0

In RMarkdown, when I insert a flowchart created with package DiagrammeR it turns out that there is a lot of empty space around the chart (above and below). How can I get rid of that empty space, please?

I tried fig.height as a chunk option but it does not help.

---
title: "Untitled"
output:
  pdf_document: default
---

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

## A flowchart

Some explaining text.

```{r echo = FALSE, message=FALSE, warning=FALSE}
library(DiagrammeR)
DiagrammeR("
           graph LR
           A-->B
           A-->C
           C-->E
           B-->D
           C-->D
           D-->F
           E-->F
           ")
```
More explaining text.
Blockhuette
  • 211
  • 1
  • 2
  • 10

1 Answers1

0

Try adding width = "100%", height = "100% like this:

DiagrammeR("
       graph LR
       A-->B
       A-->C
       C-->E
       B-->D
       C-->D
       D-->F
       E-->F
       ", width = "100%", height = "100%)
Unheilig
  • 16,196
  • 193
  • 68
  • 98
  • Thanks, however, ", width = "100%", height = "100%" is not accepted when I try (R 3.6.2). Meanwhile even the graph is not shown anymore when I use the original code. – Blockhuette May 05 '20 at 09:31