I reviewed #256, #70, #207, #133 but couldn't quite find a solution.
A plot generated in a knitr chunk (e.g. by ggplot) gets saved as a figure with a filename that is passed from the chunk label, in _bookdown_files directory. The same is not done with grViz figures. To emulate this behaviour, one can do the following to both print and save a grViz figure
library(magrittr)
g <- DiagrammeR::grViz('digraph{a->b; c->a; c->b; c->d;}')
g
g %>%
DiagrammeRsvg::export_svg() %>%
charToRaw() %>%
rsvg::rsvg_png("g.png")
I reviewed #256, #70, #207, #133 but couldn't quite find a solution.
A plot generated in a
knitr
chunk (e.g. by ggplot) gets saved as a figure with a filename that is passed from the chunk label, in_bookdown_files
directory. The same is not done withgrViz
figures. To emulate this behaviour, one can do the following to both print and save agrViz
figureCreated on 2019-04-25 by the reprex package (v0.2.1)
But this does not programatically pass the chunk label to the
png
file name and put it in the same directory as the other saved figures.