I am using DiagrammeR::grViz in R Markdown to build a flowchart. However, I couldn't find out how to control the distance between the flow chart and the margins of the diagram. Here is my YAML, very simple:
title: Very good title
author: "Mr author"
date: "`r Sys.Date()`"
output:
word_document:
reference_docx: template.docx
and the setup chunk:
{r setup}
library(DiagrammeR)
knitr::opts_knit$set(root.dir= normalizePath('..'), echo = F)
knitr::opts_chunk$set(error = F, echo = F, warning = F, fig.width=8, fig.height=6)
and here is my code in a markdown chunk
{r echo = F}
DiagrammeR::grViz("
digraph StudyFC {graph [layout = dot, fontsize = 12]
# node definitions with substituted label text
node [shape = rectangle, fillcolor = Biege]
total [label = '@@1']
excluded [label = '@@2 \n \n @@3']
final [label = '@@4']
total -> excluded -> final
}
")
The distance marked with the red file is what I want to control: grViz Outcome
And this is what I am looking for: Flowchart