DiagrammeR
DiagrammeR copied to clipboard
export_graph() does nothing
The following code does nothing for me.
library("DiagrammeR")
# Create node data frame (ndf)
ndf <- create_node_df(n = 7,
label = c("Contains\n longitudinal data", "Exclude",
"Data is available\n online", "Exclude",
"Author(s) responded to\n initial e-mail", "Exclude",
"Use"),
y = 7:1,
x = rep(1:2, times = 7),
shape = "rectangle", fillcolor = "white", fixedsize = FALSE)
# Create an edge data frame (edf)
edf <- create_edge_df(from = rep(c(1, 3, 5), each = 2),
to = c(2, 3, 4, 5, 6, 7),
label = rep(c("yes", "no"), times = 3))
# Create graph
a <- create_graph(nodes_df = ndf, edges_df = edf)
# a %>% render_graph()
a %>% export_graph(file_name = "dataflow-1.pdf", file_type = "pdf")
Created on 2019-01-30 by the reprex package (v0.2.0).
Click here to see my session info:
Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.5.1 (2018-07-02)
#> system x86_64, linux-gnu
#> ui X11
#> language en_US.UTF-8
#> collate en_US.UTF-8
#> tz Europe/Berlin
#> date 2019-01-30
#> Packages -----------------------------------------------------------------
#> package * version date
#> assertthat 0.2.0 2017-04-11
#> backports 1.1.2 2017-12-13
#> base * 3.5.1 2018-07-25
#> bindr 0.1.1 2018-03-13
#> bindrcpp 0.2.2 2018-03-29
#> brew 1.0-6 2011-04-13
#> colorspace 1.3-2 2016-12-14
#> compiler 3.5.1 2018-07-25
#> crayon 1.3.4 2017-09-16
#> datasets * 3.5.1 2018-07-25
#> devtools 1.13.6 2018-06-27
#> DiagrammeR * 1.0.0 2019-01-30
#> digest 0.6.18 2018-10-10
#> downloader 0.4 2015-07-09
#> dplyr 0.7.8 2018-11-10
#> evaluate 0.11 2018-07-17
#> ggplot2 3.1.0 2018-10-25
#> glue 1.3.0 2018-07-17
#> graphics * 3.5.1 2018-07-25
#> grDevices * 3.5.1 2018-07-25
#> grid 3.5.1 2018-07-25
#> gridExtra 2.3 2017-09-09
#> gtable 0.2.0 2016-02-26
#> hms 0.4.2 2018-03-10
#> htmltools 0.3.6 2017-04-28
#> htmlwidgets 1.3 2018-09-30
#> igraph 1.2.2 2018-07-27
#> influenceR 0.1.0 2015-09-03
#> jsonlite 1.6 2018-12-07
#> knitr 1.20 2018-02-20
#> lazyeval 0.2.1 2017-10-29
#> magrittr 1.5 2014-11-22
#> memoise 1.1.0 2017-04-21
#> methods * 3.5.1 2018-07-25
#> munsell 0.5.0 2018-06-12
#> pillar 1.3.1 2018-12-15
#> pkgconfig 2.0.2 2018-08-16
#> plyr 1.8.4 2016-06-08
#> purrr 0.3.0 2019-01-27
#> R6 2.3.0 2018-10-04
#> RColorBrewer 1.1-2 2014-12-07
#> Rcpp 1.0.0 2018-11-07
#> readr 1.3.1 2018-12-21
#> rgexf 0.15.3 2015-03-24
#> rlang 0.3.1 2019-01-08
#> rmarkdown 1.10 2018-06-11
#> Rook 1.1-1 2014-10-20
#> rprojroot 1.3-2 2018-01-03
#> rstudioapi 0.9.0 2019-01-09
#> scales 1.0.0 2018-08-09
#> stats * 3.5.1 2018-07-25
#> stringi 1.2.4 2018-07-20
#> stringr 1.3.1 2018-05-10
#> tibble 2.0.1 2019-01-12
#> tidyr 0.8.2 2018-10-28
#> tidyselect 0.2.5 2018-10-11
#> tools 3.5.1 2018-07-25
#> utils * 3.5.1 2018-07-25
#> viridis 0.5.1 2018-03-29
#> viridisLite 0.3.0 2018-02-01
#> visNetwork 2.0.5 2018-12-05
#> withr 2.1.2 2018-03-15
#> XML 3.98-1.16 2018-08-19
#> yaml 2.2.0 2018-07-25
#> source
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> local
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> local
#> CRAN (R 3.5.1)
#> local
#> CRAN (R 3.5.1)
#> Github (rich-iannone/DiagrammeR@3b29629)
#> cran (@0.6.18)
#> CRAN (R 3.5.1)
#> cran (@0.7.8)
#> CRAN (R 3.5.1)
#> cran (@3.1.0)
#> CRAN (R 3.5.1)
#> local
#> local
#> local
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@1.3)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@1.6)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> local
#> CRAN (R 3.5.1)
#> cran (@1.3.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@2.3.0)
#> CRAN (R 3.5.1)
#> cran (@1.0.0)
#> cran (@1.3.1)
#> CRAN (R 3.5.1)
#> cran (@0.3.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@0.9.0)
#> CRAN (R 3.5.1)
#> local
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@2.0.1)
#> cran (@0.8.2)
#> cran (@0.2.5)
#> local
#> local
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@2.0.5)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
Am I doing something wrong? Would really appreciate some help :cake: :cat:
Hi @HeidiSeibold , sorry for the trouble with export_graph()
. The way to make this work (I hope!) is to first install the DiagrammeRsvg package (it's available from CRAN). Let me know if that solves the problem.
Note to self: I should have is a message stating that it needs to be installed (if it's not present).
Unfortunately I cannot check because the installation failed, see here: https://github.com/jeroen/V8/issues/49
Will keep you updated.
Installation worked now, but I still have the same issue (see jeroen/V8#48)
library("DiagrammeR")
library("DiagrammeRsvg")
# Create node data frame (ndf)
ndf <- create_node_df(n = 7,
label = c("Contains\n longitudinal data", "Exclude",
"Data is available\n online", "Exclude",
"Author(s) responded to\n initial e-mail", "Exclude",
"Use"),
y = 7:1,
x = rep(1:2, times = 7),
shape = "rectangle", fillcolor = "white", fixedsize = FALSE)
# Create an edge data frame (edf)
edf <- create_edge_df(from = rep(c(1, 3, 5), each = 2),
to = c(2, 3, 4, 5, 6, 7),
label = rep(c("yes", "no"), times = 3))
# Create graph
a <- create_graph(nodes_df = ndf, edges_df = edf)
# a %>% render_graph()
a %>% export_graph(file_name = "dataflow-1.pdf", file_type = "pdf")
Created on 2019-02-07 by the reprex package (v0.2.0).
Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.5.1 (2018-07-02)
#> system x86_64, linux-gnu
#> ui X11
#> language en_US.UTF-8
#> collate en_US.UTF-8
#> tz Europe/Berlin
#> date 2019-02-07
#> Packages -----------------------------------------------------------------
#> package * version date
#> assertthat 0.2.0 2017-04-11
#> backports 1.1.2 2017-12-13
#> base * 3.5.1 2018-07-25
#> bindr 0.1.1 2018-03-13
#> bindrcpp 0.2.2 2018-03-29
#> brew 1.0-6 2011-04-13
#> colorspace 1.3-2 2016-12-14
#> compiler 3.5.1 2018-07-25
#> crayon 1.3.4 2017-09-16
#> curl 3.3 2019-01-10
#> datasets * 3.5.1 2018-07-25
#> devtools 1.13.6 2018-06-27
#> DiagrammeR * 1.0.0 2019-01-30
#> DiagrammeRsvg * 0.1 2016-02-04
#> digest 0.6.18 2018-10-10
#> downloader 0.4 2015-07-09
#> dplyr 0.7.8 2018-11-10
#> evaluate 0.11 2018-07-17
#> ggplot2 3.1.0 2018-10-25
#> glue 1.3.0 2018-07-17
#> graphics * 3.5.1 2018-07-25
#> grDevices * 3.5.1 2018-07-25
#> grid 3.5.1 2018-07-25
#> gridExtra 2.3 2017-09-09
#> gtable 0.2.0 2016-02-26
#> hms 0.4.2 2018-03-10
#> htmltools 0.3.6 2017-04-28
#> htmlwidgets 1.3 2018-09-30
#> igraph 1.2.2 2018-07-27
#> influenceR 0.1.0 2015-09-03
#> jsonlite 1.6 2018-12-07
#> knitr 1.20 2018-02-20
#> lazyeval 0.2.1 2017-10-29
#> magrittr 1.5 2014-11-22
#> memoise 1.1.0 2017-04-21
#> methods * 3.5.1 2018-07-25
#> munsell 0.5.0 2018-06-12
#> pillar 1.3.1 2018-12-15
#> pkgconfig 2.0.2 2018-08-16
#> plyr 1.8.4 2016-06-08
#> purrr 0.3.0 2019-01-27
#> R6 2.3.0 2018-10-04
#> RColorBrewer 1.1-2 2014-12-07
#> Rcpp 1.0.0 2018-11-07
#> readr 1.3.1 2018-12-21
#> rgexf 0.15.3 2015-03-24
#> rlang 0.3.1 2019-01-08
#> rmarkdown 1.10 2018-06-11
#> Rook 1.1-1 2014-10-20
#> rprojroot 1.3-2 2018-01-03
#> rstudioapi 0.9.0 2019-01-09
#> scales 1.0.0 2018-08-09
#> stats * 3.5.1 2018-07-25
#> stringi 1.2.4 2018-07-20
#> stringr 1.3.1 2018-05-10
#> tibble 2.0.1 2019-01-12
#> tidyr 0.8.2 2018-10-28
#> tidyselect 0.2.5 2018-10-11
#> tools 3.5.1 2018-07-25
#> utils * 3.5.1 2018-07-25
#> V8 2.0 2019-02-07
#> viridis 0.5.1 2018-03-29
#> viridisLite 0.3.0 2018-02-01
#> visNetwork 2.0.5 2018-12-05
#> withr 2.1.2 2018-03-15
#> XML 3.98-1.16 2018-08-19
#> yaml 2.2.0 2018-07-25
#> source
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> local
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> local
#> CRAN (R 3.5.1)
#> cran (@3.3)
#> local
#> CRAN (R 3.5.1)
#> Github (rich-iannone/DiagrammeR@3b29629)
#> CRAN (R 3.5.1)
#> cran (@0.6.18)
#> CRAN (R 3.5.1)
#> cran (@0.7.8)
#> CRAN (R 3.5.1)
#> cran (@3.1.0)
#> CRAN (R 3.5.1)
#> local
#> local
#> local
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@1.3)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@1.6)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> local
#> CRAN (R 3.5.1)
#> cran (@1.3.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@2.3.0)
#> CRAN (R 3.5.1)
#> cran (@1.0.0)
#> cran (@1.3.1)
#> CRAN (R 3.5.1)
#> cran (@0.3.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@0.9.0)
#> CRAN (R 3.5.1)
#> local
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@2.0.1)
#> cran (@0.8.2)
#> cran (@0.2.5)
#> local
#> local
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> cran (@2.0.5)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
#> CRAN (R 3.5.1)
I have the same issue, in this case with a PNG file output. Loading DiagrammeRsvg does not, unfortunately, fix the problem.
Additionally, an error message produced is "Error in loadNamespace(name) : there is no package called ‘rsvg’" (Which I presume is because rsvg is not a dependency in the DESCRIPTION file to enable non-manual loading?)
I have a similar issue with the export_svg
function...:
library(DiagrammeR)
svg <- export_svg(grViz('digraph{a->b; c->a; c->b; c->d;}'))
#
# Fatal error in ../src/platform-linux.cc, line 782
# CHECK_EQ(0, result) failed
# Expected: 0
# Found: 22
#
==== Stack trace is not available ==========================
==== Isolate for the thread is not initialized =============
Trace/breakpoint trap (core dumped)
devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 3.6.1 (2019-07-05)
os Manjaro Linux
system x86_64, linux-gnu
ui X11
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/Toronto
date 2019-10-28
─ Packages ───────────────────────────────────────────────────────────────────
package * version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.1)
backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.1)
callr 3.3.2 2019-09-22 [1] CRAN (R 3.6.1)
cli 1.1.0 2019-03-19 [1] CRAN (R 3.6.1)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.1)
curl 4.2 2019-09-24 [1] CRAN (R 3.6.1)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.6.1)
devtools 2.2.1 2019-09-24 [1] CRAN (R 3.6.1)
DiagrammeRsvg * 0.1 2016-02-04 [1] CRAN (R 3.6.1)
digest 0.6.21 2019-09-20 [1] CRAN (R 3.6.1)
ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.1)
fs 1.3.1 2019-05-06 [1] CRAN (R 3.6.1)
glue 1.3.1 2019-03-12 [1] CRAN (R 3.6.1)
jsonlite 1.6 2018-12-07 [1] CRAN (R 3.6.1)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.6.1)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.1)
pkgbuild 1.0.6 2019-10-09 [1] CRAN (R 3.6.1)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.1)
prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.6.1)
processx 3.4.1 2019-07-18 [1] CRAN (R 3.6.1)
ps 1.3.0 2018-12-21 [1] CRAN (R 3.6.1)
R6 2.4.0 2019-02-14 [1] CRAN (R 3.6.1)
Rcpp 1.0.2 2019-07-25 [1] CRAN (R 3.6.1)
remotes 2.1.0 2019-06-24 [1] CRAN (R 3.6.1)
rlang 0.4.0 2019-06-25 [1] CRAN (R 3.6.1)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.6.1)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.1)
testthat 2.2.1 2019-07-25 [1] CRAN (R 3.6.1)
usethis 1.5.1 2019-07-04 [1] CRAN (R 3.6.1)
V8 2.3 2019-07-02 [1] CRAN (R 3.6.1)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.1)
[1] /home/sebastien/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/lib/R/library
I encountered this issue as well. export_graph()
failed to output a PDF without returning a warning or error.
After additionally installing {rsvg} and {DiagrammeRsvg}, it worked.
The current logic doesn't correctly emit the intended error message.
Hi It finally created the png for me after also adding the library rsvg.
I have: library(DiagrammeR) library(DiagrammeRsvg) library(rsvg)
I can confirm this works only if you load both DiagrammeRsvg and rsvg. If not, export_graph() does nothing.
Maybe you need to install rsvg also @HeidiSeibold
Ah yes, that works. Thank you :pray: :clap:
Maybe it would be helpful for users to get a warning if they don't have the package installed + loaded. :thinking:
library(DiagrammeR) library(DiagrammeRsvg) library(rsvg)
Loading all these as @midraed suggested worked for me too. +1 for adding warning message as suggested by @HeidiSeibold :)