stocnet / manynet

Many Ways to Make, Manipulate, and Map Myriad Networks
https://stocnet.github.io/manynet/
Other
12 stars 0 forks source link

`graphs()` collecting guides doesn't work for different range in the visual variables #85

Open auzaheta opened 2 months ago

auzaheta commented 2 months ago

Describe the bug When creating a plot using graphs(), the collecting guides of patchwork doesn't work when the different networks have a different range of values.

To Reproduce

library(manynet)
#> Warning: package 'manynet' was built under R version 4.3.3
#> Registered S3 method overwritten by 'manynet':
#>   method          from     
#>   print.tbl_graph tidygraph
net0 <- matrix(
  c(
    0, 0, 0, 2, 0,
    0, 0, 4, 0, 0,
    0, 4, 0, 0, 0,
    2, 0, 0, 0, 1,
    0, 0, 0, 1, 0 
  ),
  nrow = 5, ncol = 5,
  dimnames = list(letters[seq(5)], letters[seq(5)])
) |> 
  as_igraph()

net1 <- matrix(
  c(
    0, 0, 0, 2, 0,
    0, 0, 4, 0, 0,
    0, 4, 0, 0, 0,
    2, 0, 0, 0, 0,
    0, 0, 0, 0, 0 
  ),
  nrow = 5, ncol = 5,
  dimnames = list(letters[seq(5)], letters[seq(5)])
) |> 
  as_igraph()

graphs(list(net0, net1))

Created on 2024-09-04 with reprex v2.1.1

Provide system information


─ Session info ────
 setting  value
 version  R version 4.3.1 (2023-06-16 ucrt)
 os       Windows 10 x64 (build 19045)
 system   x86_64, mingw32
 ui       RStudio
 language EN
 collate  German_Switzerland.utf8
 ctype    German_Switzerland.utf8
 tz       Europe/Zurich
 date     2024-09-04
 rstudio  2024.04.1+748 Chocolate Cosmos (desktop)

─ Packages ────
 package        * version date (UTC) lib source
 cachem           1.0.8   2023-05-01 [1] CRAN (R 4.3.1)
 callr            3.7.3   2022-11-02 [1] CRAN (R 4.3.1)
 cli              3.6.2   2023-12-11 [1] CRAN (R 4.3.3)
 coda             0.19-4  2020-09-30 [1] CRAN (R 4.3.1)
 colorspace       2.1-0   2023-01-23 [1] CRAN (R 4.3.1)
 crayon           1.5.2   2022-09-29 [1] CRAN (R 4.3.1)
 devtools         2.4.5   2022-10-11 [1] CRAN (R 4.3.1)
 digest           0.6.33  2023-07-07 [1] CRAN (R 4.3.1)
 dplyr            1.1.4   2023-11-17 [1] CRAN (R 4.3.3)
 ellipsis         0.3.2   2021-04-29 [1] CRAN (R 4.3.1)
 fansi            1.0.6   2023-12-08 [1] CRAN (R 4.3.3)
 farver           2.1.2   2024-05-13 [1] CRAN (R 4.3.3)
 fastmap          1.1.1   2023-02-24 [1] CRAN (R 4.3.1)
 fortunes         1.5-4   2016-12-29 [1] CRAN (R 4.3.0)
 fs               1.6.3   2023-07-20 [1] CRAN (R 4.3.1)
 generics         0.1.3   2022-07-05 [1] CRAN (R 4.3.1)
 ggforce          0.4.1   2022-10-04 [1] CRAN (R 4.3.1)
 ggplot2          3.5.1   2024-04-23 [1] CRAN (R 4.3.3)
 ggraph           2.1.0   2022-10-09 [1] CRAN (R 4.3.1)
 ggrepel          0.9.4   2023-10-13 [1] CRAN (R 4.3.1)
 glue             1.7.0   2024-01-09 [1] CRAN (R 4.3.3)
 graphlayouts     1.0.1   2023-09-19 [1] CRAN (R 4.3.1)
 gridExtra        2.3     2017-09-09 [1] CRAN (R 4.3.1)
 gtable           0.3.5   2024-04-22 [1] CRAN (R 4.3.3)
 htmltools        0.5.7   2023-11-03 [1] CRAN (R 4.3.2)
 htmlwidgets      1.6.2   2023-03-17 [1] CRAN (R 4.3.1)
 httpuv           1.6.12  2023-10-23 [1] CRAN (R 4.3.2)
 igraph           2.0.2   2024-02-17 [1] CRAN (R 4.3.3)
 later            1.3.1   2023-05-02 [1] CRAN (R 4.3.1)
 lattice          0.21-8  2023-04-05 [1] CRAN (R 4.3.1)
 lifecycle        1.0.4   2023-11-07 [1] CRAN (R 4.3.2)
 magrittr         2.0.3   2022-03-30 [1] CRAN (R 4.3.1)
 manynet        * 1.0.5   2024-08-30 [1] CRAN (R 4.3.3)
 MASS             7.3-60  2023-05-04 [1] CRAN (R 4.3.1)
 memoise          2.0.1   2021-11-26 [1] CRAN (R 4.3.1)
 mime             0.12    2021-09-28 [1] CRAN (R 4.3.0)
 miniUI           0.1.1.1 2018-05-18 [1] CRAN (R 4.3.1)
 minMSE           0.5.1   2021-11-26 [1] CRAN (R 4.3.3)
 munsell          0.5.1   2024-04-01 [1] CRAN (R 4.3.3)
 network          1.18.1  2023-01-24 [1] CRAN (R 4.3.1)
 pillar           1.9.0   2023-03-22 [1] CRAN (R 4.3.1)
 pkgbuild         1.4.2   2023-06-26 [1] CRAN (R 4.3.1)
 pkgconfig        2.0.3   2019-09-22 [1] CRAN (R 4.3.1)
 pkgload          1.3.3   2023-09-22 [1] CRAN (R 4.3.1)
 polyclip         1.10-6  2023-09-27 [1] CRAN (R 4.3.1)
 prettyunits      1.2.0   2023-09-24 [1] CRAN (R 4.3.1)
 processx         3.8.2   2023-06-30 [1] CRAN (R 4.3.1)
 profvis          0.3.8   2023-05-02 [1] CRAN (R 4.3.1)
 promises         1.2.1   2023-08-10 [1] CRAN (R 4.3.1)
 ps               1.7.5   2023-04-18 [1] CRAN (R 4.3.1)
 purrr            1.0.2   2023-08-10 [1] CRAN (R 4.3.1)
 R6               2.5.1   2021-08-19 [1] CRAN (R 4.3.1)
 Rcpp             1.0.12  2024-01-09 [1] CRAN (R 4.3.3)
 remotes          2.4.2.1 2023-07-18 [1] CRAN (R 4.3.1)
 rlang          * 1.1.4   2024-06-04 [1] CRAN (R 4.3.3)
 rstudioapi       0.15.0  2023-07-07 [1] CRAN (R 4.3.1)
 scales           1.3.0   2023-11-28 [1] CRAN (R 4.3.3)
 sessioninfo      1.2.2   2021-12-06 [1] CRAN (R 4.3.1)
 shiny            1.7.5   2023-08-12 [1] CRAN (R 4.3.1)
 statnet.common   4.9.0   2023-05-24 [1] CRAN (R 4.3.1)
 stringi          1.8.2   2023-11-23 [1] CRAN (R 4.3.1)
 stringr          1.5.1   2023-11-14 [1] CRAN (R 4.3.2)
 tibble           3.2.1   2023-03-20 [1] CRAN (R 4.3.1)
 tidygraph        1.2.3   2023-02-01 [1] CRAN (R 4.3.1)
 tidyr            1.3.0   2023-01-24 [1] CRAN (R 4.3.1)
 tidyselect       1.2.1   2024-03-11 [1] CRAN (R 4.3.3)
 tweenr           2.0.2   2022-09-06 [1] CRAN (R 4.3.1)
 urlchecker       1.0.1   2021-11-30 [1] CRAN (R 4.3.1)
 usethis          2.2.2   2023-07-06 [1] CRAN (R 4.3.1)
 utf8             1.2.4   2023-10-22 [1] CRAN (R 4.3.3)
 vctrs            0.6.5   2023-12-01 [1] CRAN (R 4.3.3)
 viridis          0.6.4   2023-07-22 [1] CRAN (R 4.3.1)
 viridisLite      0.4.2   2023-05-02 [1] CRAN (R 4.3.1)
 withr            3.0.0   2024-01-16 [1] CRAN (R 4.3.3)
 xtable           1.8-4   2019-04-21 [1] CRAN (R 4.3.1)

Expected behavior It would be better that the subplots have the same range of values for the visual variables. Guides would be collected correctly, and the plots can be compared visually in a straightforward way.