process maps seem to be rendering strangely with latest diagrammeR
zyaar opened this issue · 1 comments
When using process_map and rendering a graph with the latest version of everything (see sessionInfo() below), the process maps seem to be rendering with text fonts which are too large and activity boxes which are too large (problem_rendering.png):
library(DiagrammeR)
library(bupaR)
process_map(patients)
However, you can render correctly using the following (at least it looks correct):
library(DiagrammeR)
library(bupaR)
test1 <- process_map(patients, render = FALSE)
render_graph(test1)
I believe the problem is in process_map.R file, starting at line 324:
# Since DiagrammeR does not support the necessary GraphViz attributes,
# we use a workaround to add them tot the DOT code. See the issue logged here:
# https://github.com/rich-iannone/DiagrammeR/issues/360
# hack to add 'weight' attribute to the graph
graph$edges_df %>%
mutate(len = weight, decorate = constraint) -> graph$edges_df
graph %>% render_graph() -> graph
graph$x$diagram %>%
stringr::str_replace_all("len", "weight") %>%
stringr::str_replace_all("decorate", "constraint") -> graph$x$diagram
attr(graph, "base_precedence") <- base_precedence
graph %>% return()
I am not sure this code works correctly with the latest version of DiagrammeR (or maybe some other packages that DiagrammeR depends on).
Unfortunately, the workaround fix doesn't help me because I use processanimateR to render the graphs in order to get the token animation.
My sessionInfo is below:
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] processanimateR_1.0.1 DiagrammeR_1.0.0 petrinetR_0.2.1.9000 processmonitR_0.1.0 xesreadR_0.2.3.9000 processmapR_0.3.3.9000 eventdataR_0.2.0.9000 edeaR_0.8.3
[9] bupaR_0.4.2
loaded via a namespace (and not attached):
[1] zoo_1.8-6 tidyselect_0.2.5 purrr_0.3.3 ggthemes_4.2.0 lattice_0.20-38 V8_2.3 colorspace_1.4-1 vctrs_0.2.0.9007 miniUI_0.1.1.1
[10] htmltools_0.4.0 viridisLite_0.3.0 yaml_2.2.0 XML_3.98-1.20 plotly_4.9.1 rlang_0.4.2 later_1.0.0 pillar_1.4.2.9001 glue_1.3.1
[19] DiagrammeRsvg_0.1 RColorBrewer_1.1-2 lifecycle_0.1.0 stringr_1.4.0 munsell_0.5.0 gtable_0.3.0 visNetwork_2.0.8 htmlwidgets_1.5.1 forcats_0.4.0
[28] fastmap_1.0.1 httpuv_1.5.2 curl_4.2 Rcpp_1.0.3 xtable_1.8-4 promises_1.1.0 scales_1.1.0 jsonlite_1.6 lobstr_1.1.1
[37] mime_0.7 ggplot2_3.2.1 hms_0.5.2 digest_0.6.23 stringi_1.4.3 dplyr_0.8.99.9000 shiny_1.4.0 grid_3.5.1 tools_3.5.1
[46] magrittr_1.5 lazyeval_0.2.2 tibble_2.99.99.9010 crayon_1.3.4 tidyr_1.0.0 pkgconfig_2.0.3 zeallot_0.1.0 xml2_1.2.2 data.table_1.12.6
[55] lubridate_1.7.4 assertthat_0.2.1 httr_1.4.1 rstudioapi_0.10 R6_2.4.1 igraph_1.2.4.1 shinyTime_1.0.1 compiler_3.5.1
Accidentally posted this to the wrong repository (was support to go to processmapR, not processanimateR).