-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug with geom_edge_sf #277
Comments
Slightly more minimal example with the github version of library(sfnetworks)
library(ggraph)
#> Loading required package: ggplot2
gr <- sfnetworks::as_sfnetwork(roxel)
ggraph(gr, 'sf') + geom_edge_sf()
#> Error in `geom_edge_sf()`:
#> ! Problem while converting geom to grob.
#> ℹ Error occurred in the 1st layer.
#> Caused by error in `check.length()`:
#> ! 'gpar' element 'fontsize' must not be length 0
#> Backtrace:
#> ▆
#> 1. ├─base::tryCatch(...)
#> 2. │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#> 3. │ ├─base (local) tryCatchOne(...)
#> 4. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#> 5. │ └─base (local) tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
#> 6. │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#> 7. │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#> 8. ├─base::withCallingHandlers(...)
#> 9. ├─base::saveRDS(...)
#> 10. ├─base::do.call(...)
#> 11. ├─base (local) `<fn>`(...)
#> 12. ├─global `<fn>`(input = base::quote("cushy-kitty_reprex.R"))
#> 13. │ └─rmarkdown::render(input, quiet = TRUE, envir = globalenv(), encoding = "UTF-8")
#> 14. │ └─knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
#> 15. │ └─knitr:::process_file(text, output)
#> 16. │ ├─xfun:::handle_error(...)
#> 17. │ ├─base::withCallingHandlers(...)
#> 18. │ └─knitr:::process_group(group)
#> 19. │ └─knitr:::call_block(x)
#> 20. │ └─knitr:::block_exec(params)
#> 21. │ └─knitr:::eng_r(options)
#> 22. │ ├─knitr:::in_input_dir(...)
#> 23. │ │ └─knitr:::in_dir(input_dir(), expr)
#> 24. │ └─knitr (local) evaluate(...)
#> 25. │ └─evaluate::evaluate(...)
#> 26. │ └─evaluate:::evaluate_call(...)
#> 27. │ ├─evaluate (local) handle(...)
#> 28. │ │ └─base::try(f, silent = TRUE)
#> 29. │ │ └─base::tryCatch(...)
#> 30. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#> 31. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#> 32. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#> 33. │ ├─base::withCallingHandlers(...)
#> 34. │ ├─base::withVisible(value_fun(ev$value, ev$visible))
#> 35. │ └─knitr (local) value_fun(ev$value, ev$visible)
#> 36. │ └─knitr (local) fun(x, options = options)
#> 37. │ ├─base::withVisible(knit_print(x, ...))
#> 38. │ ├─knitr::knit_print(x, ...)
#> 39. │ └─knitr:::knit_print.default(x, ...)
#> 40. │ └─evaluate (local) normal_print(x)
#> 41. │ ├─base::print(x)
#> 42. │ └─ggplot2:::print.ggplot(x)
#> 43. │ ├─ggplot2::ggplot_gtable(data)
#> 44. │ └─ggplot2:::ggplot_gtable.ggplot_built(data)
#> 45. │ └─ggplot2:::by_layer(...)
#> 46. │ ├─rlang::try_fetch(...)
#> 47. │ │ ├─base::tryCatch(...)
#> 48. │ │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#> 49. │ │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#> 50. │ │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#> 51. │ │ └─base::withCallingHandlers(...)
#> 52. │ └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
#> 53. │ └─l$draw_geom(d, layout)
#> 54. │ └─ggplot2 (local) draw_geom(..., self = self)
#> 55. │ └─self$geom$draw_layer(...)
#> 56. │ └─ggplot2 (local) draw_layer(..., self = self)
#> 57. │ └─base::lapply(...)
#> 58. │ └─ggplot2 (local) FUN(X[[i]], ...)
#> 59. │ ├─rlang::inject(self$draw_panel(data, panel_params, coord, !!!params))
#> 60. │ └─self$draw_panel(data, panel_params, coord)
#> 61. │ └─ggraph (local) draw_panel(...)
#> 62. │ └─GeomSf$draw_panel(data, panel_params, coords)
#> 63. │ └─ggplot2 (local) draw_panel(..., self = self)
#> 64. │ └─grid::gpar(...)
#> 65. │ └─grid:::validGP(list(...))
#> 66. │ └─grid (local) numnotnull("fontsize")
#> 67. │ └─grid (local) check.length(gparname)
#> 68. │ └─base::stop(...)
#> 69. └─base::.handleSimpleError(...)
#> 70. └─rlang (local) h(simpleError(msg, call))
#> 71. └─handlers[[1L]](cnd)
#> 72. └─cli::cli_abort(...)
#> 73. └─rlang::abort(...) Created on 2024-11-14 with reprex v2.0.2 Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.3.1 (2023-06-16 ucrt)
#> os Windows 11 x64 (build 22631)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United Kingdom.utf8
#> ctype English_United Kingdom.utf8
#> tz Europe/Rome
#> date 2024-11-14
#> pandoc 3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> abind 1.4-8 2024-09-12 [1] CRAN (R 4.3.1)
#> cachem 1.1.0 2024-05-16 [1] CRAN (R 4.3.3)
#> class 7.3-22 2023-05-03 [2] CRAN (R 4.3.1)
#> classInt 0.4-10 2023-09-05 [1] CRAN (R 4.3.1)
#> cli 3.6.3.9000 2024-10-22 [1] Github (r-lib/cli@38cef38)
#> colorspace 2.1-1 2024-07-26 [1] CRAN (R 4.3.1)
#> DBI 1.2.3 2024-06-02 [1] CRAN (R 4.3.1)
#> deldir 2.0-4 2024-02-28 [1] CRAN (R 4.3.1)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.3.1)
#> dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.3.1)
#> e1071 1.7-16 2024-09-16 [1] CRAN (R 4.3.1)
#> evaluate 0.24.0 2024-06-10 [1] CRAN (R 4.3.3)
#> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.3.2)
#> farver 2.1.2 2024-05-13 [1] CRAN (R 4.3.1)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.3.3)
#> fs 1.6.4 2024-04-25 [1] CRAN (R 4.3.3)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.1)
#> ggforce 0.4.2 2024-02-19 [1] CRAN (R 4.3.3)
#> ggplot2 * 3.5.1.9000 2024-11-13 [1] Github (tidyverse/ggplot2@f468053)
#> ggraph * 2.2.1.9000 2024-11-13 [1] Github (thomasp85/ggraph@9a0bfb1)
#> 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.2)
#> goftest 1.2-3 2021-10-07 [1] CRAN (R 4.3.1)
#> graphlayouts 1.1.1 2024-03-09 [1] CRAN (R 4.3.3)
#> gridExtra 2.3 2017-09-09 [1] CRAN (R 4.3.1)
#> gtable 0.3.5 2024-04-22 [1] CRAN (R 4.3.1)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.3.3)
#> igraph 2.1.1 2024-10-19 [1] CRAN (R 4.3.1)
#> KernSmooth 2.23-21 2023-05-03 [2] CRAN (R 4.3.1)
#> knitr 1.48 2024-07-07 [1] CRAN (R 4.3.1)
#> lattice 0.21-8 2023-04-05 [2] CRAN (R 4.3.1)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.2)
#> lwgeom 0.2-14 2024-02-21 [1] CRAN (R 4.3.1)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.1)
#> MASS 7.3-60 2023-05-04 [2] CRAN (R 4.3.1)
#> Matrix 1.6-1.1 2023-09-18 [1] CRAN (R 4.3.1)
#> memoise 2.0.1 2021-11-26 [1] CRAN (R 4.3.1)
#> mgcv 1.9-1 2023-12-21 [1] CRAN (R 4.3.1)
#> munsell 0.5.1 2024-04-01 [1] CRAN (R 4.3.3)
#> nlme 3.1-162 2023-01-31 [2] CRAN (R 4.3.1)
#> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.1)
#> polyclip 1.10-7 2024-07-23 [1] CRAN (R 4.3.1)
#> proxy 0.4-27 2022-06-09 [1] CRAN (R 4.3.1)
#> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.1)
#> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.3.1)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.3.1)
#> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.3.1)
#> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.3.1)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.1)
#> Rcpp 1.0.13 2024-07-17 [1] CRAN (R 4.3.1)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.3.1)
#> rlang 1.1.4 2024-06-04 [1] CRAN (R 4.3.1)
#> rmarkdown 2.28 2024-08-17 [1] CRAN (R 4.3.1)
#> rpart 4.1.19 2022-10-21 [2] CRAN (R 4.3.1)
#> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.3.1)
#> scales 1.3.0 2023-11-28 [1] CRAN (R 4.3.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.1)
#> sf 1.0-19 2024-11-05 [1] CRAN (R 4.3.1)
#> sfheaders 0.4.4 2024-01-17 [1] CRAN (R 4.3.3)
#> sfnetworks * 0.6.4 2024-11-14 [1] Github (luukvdmeer/sfnetworks@31b4027)
#> spatstat.data 3.1-2 2024-06-21 [1] CRAN (R 4.3.1)
#> spatstat.explore 3.3-2 2024-08-21 [1] CRAN (R 4.3.1)
#> spatstat.geom 3.3-3 2024-09-18 [1] CRAN (R 4.3.1)
#> spatstat.linnet 3.2-2 2024-09-20 [1] CRAN (R 4.3.1)
#> spatstat.model 3.3-2 2024-09-19 [1] CRAN (R 4.3.1)
#> spatstat.random 3.3-2 2024-09-18 [1] CRAN (R 4.3.1)
#> spatstat.sparse 3.1-0 2024-06-21 [1] CRAN (R 4.3.1)
#> spatstat.univar 3.0-1 2024-09-05 [1] CRAN (R 4.3.1)
#> spatstat.utils 3.1-0 2024-08-17 [1] CRAN (R 4.3.1)
#> styler 1.10.2 2023-08-29 [1] CRAN (R 4.3.1)
#> tensor 1.5 2012-05-05 [1] CRAN (R 4.3.1)
#> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.1)
#> tidygraph 1.3.1 2024-01-30 [1] CRAN (R 4.3.1)
#> tidyr 1.3.0 2023-01-24 [1] CRAN (R 4.3.1)
#> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.3.1)
#> tweenr 2.0.3 2024-02-26 [1] CRAN (R 4.3.3)
#> units 0.8-5.4 2024-06-03 [1] local
#> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.1)
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.2)
#> 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.1 2024-07-31 [1] CRAN (R 4.3.3)
#> xfun 0.45 2024-06-16 [1] CRAN (R 4.3.3)
#> yaml 2.3.9 2024-07-05 [1] CRAN (R 4.3.3)
#>
#> [1] C:/Users/user/AppData/Local/R/win-library/4.3
#> [2] C:/Program Files/R/R-4.3.1/library
#>
#> ────────────────────────────────────────────────────────────────────────────── Same error occurs when using R from the command line. Happy to provide more details if necessary. |
btw: the previous code fails only with the github version of library(ggraph)
#> Loading required package: ggplot2
library(sfnetworks)
gr <- sfnetworks::as_sfnetwork(roxel)
ggraph(gr, 'sf') + geom_edge_sf() Created on 2024-11-18 with reprex v2.0.2 Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.3.1 (2023-06-16 ucrt)
#> os Windows 11 x64 (build 22631)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United Kingdom.utf8
#> ctype English_United Kingdom.utf8
#> tz Europe/Rome
#> date 2024-11-18
#> pandoc 3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> abind 1.4-8 2024-09-12 [1] CRAN (R 4.3.1)
#> cachem 1.1.0 2024-05-16 [1] CRAN (R 4.3.3)
#> class 7.3-22 2023-05-03 [2] CRAN (R 4.3.1)
#> classInt 0.4-10 2023-09-05 [1] CRAN (R 4.3.1)
#> cli 3.6.3.9000 2024-10-22 [1] Github (r-lib/cli@38cef38)
#> colorspace 2.1-1 2024-07-26 [1] CRAN (R 4.3.1)
#> curl 5.2.1 2024-03-01 [1] CRAN (R 4.3.3)
#> DBI 1.2.3 2024-06-02 [1] CRAN (R 4.3.1)
#> deldir 2.0-4 2024-02-28 [1] CRAN (R 4.3.1)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.3.1)
#> dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.3.1)
#> e1071 1.7-16 2024-09-16 [1] CRAN (R 4.3.1)
#> evaluate 0.24.0 2024-06-10 [1] CRAN (R 4.3.3)
#> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.3.2)
#> farver 2.1.2 2024-05-13 [1] CRAN (R 4.3.1)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.3.3)
#> fs 1.6.4 2024-04-25 [1] CRAN (R 4.3.3)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.1)
#> ggforce 0.4.2 2024-02-19 [1] CRAN (R 4.3.3)
#> ggplot2 * 3.5.1 2024-04-23 [1] CRAN (R 4.3.1)
#> ggraph * 2.2.1.9000 2024-11-13 [1] Github (thomasp85/ggraph@9a0bfb1)
#> 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.2)
#> goftest 1.2-3 2021-10-07 [1] CRAN (R 4.3.1)
#> graphlayouts 1.1.1 2024-03-09 [1] CRAN (R 4.3.3)
#> gridExtra 2.3 2017-09-09 [1] CRAN (R 4.3.1)
#> gtable 0.3.5 2024-04-22 [1] CRAN (R 4.3.1)
#> highr 0.11 2024-05-26 [1] CRAN (R 4.3.3)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.3.3)
#> igraph 2.1.1 2024-10-19 [1] CRAN (R 4.3.1)
#> KernSmooth 2.23-21 2023-05-03 [2] CRAN (R 4.3.1)
#> knitr 1.48 2024-07-07 [1] CRAN (R 4.3.1)
#> lattice 0.21-8 2023-04-05 [2] CRAN (R 4.3.1)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.2)
#> lwgeom 0.2-14 2024-02-21 [1] CRAN (R 4.3.1)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.1)
#> MASS 7.3-60 2023-05-04 [2] CRAN (R 4.3.1)
#> Matrix 1.6-1.1 2023-09-18 [1] CRAN (R 4.3.1)
#> memoise 2.0.1 2021-11-26 [1] CRAN (R 4.3.1)
#> mgcv 1.9-1 2023-12-21 [1] CRAN (R 4.3.1)
#> munsell 0.5.1 2024-04-01 [1] CRAN (R 4.3.3)
#> nlme 3.1-162 2023-01-31 [2] CRAN (R 4.3.1)
#> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.1)
#> polyclip 1.10-7 2024-07-23 [1] CRAN (R 4.3.1)
#> proxy 0.4-27 2022-06-09 [1] CRAN (R 4.3.1)
#> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.1)
#> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.3.1)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.3.1)
#> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.3.1)
#> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.3.1)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.1)
#> Rcpp 1.0.13 2024-07-17 [1] CRAN (R 4.3.1)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.3.1)
#> rlang 1.1.4 2024-06-04 [1] CRAN (R 4.3.1)
#> rmarkdown 2.28 2024-08-17 [1] CRAN (R 4.3.1)
#> rpart 4.1.19 2022-10-21 [2] CRAN (R 4.3.1)
#> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.3.1)
#> scales 1.3.0 2023-11-28 [1] CRAN (R 4.3.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.1)
#> sf 1.0-19 2024-11-05 [1] CRAN (R 4.3.1)
#> sfheaders 0.4.4 2024-01-17 [1] CRAN (R 4.3.3)
#> sfnetworks * 0.6.4 2024-11-14 [1] Github (luukvdmeer/sfnetworks@31b4027)
#> spatstat.data 3.1-2 2024-06-21 [1] CRAN (R 4.3.1)
#> spatstat.explore 3.3-2 2024-08-21 [1] CRAN (R 4.3.1)
#> spatstat.geom 3.3-3 2024-09-18 [1] CRAN (R 4.3.1)
#> spatstat.linnet 3.2-2 2024-09-20 [1] CRAN (R 4.3.1)
#> spatstat.model 3.3-2 2024-09-19 [1] CRAN (R 4.3.1)
#> spatstat.random 3.3-2 2024-09-18 [1] CRAN (R 4.3.1)
#> spatstat.sparse 3.1-0 2024-06-21 [1] CRAN (R 4.3.1)
#> spatstat.univar 3.0-1 2024-09-05 [1] CRAN (R 4.3.1)
#> spatstat.utils 3.1-0 2024-08-17 [1] CRAN (R 4.3.1)
#> styler 1.10.2 2023-08-29 [1] CRAN (R 4.3.1)
#> tensor 1.5 2012-05-05 [1] CRAN (R 4.3.1)
#> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.1)
#> tidygraph 1.3.1 2024-01-30 [1] CRAN (R 4.3.1)
#> tidyr 1.3.0 2023-01-24 [1] CRAN (R 4.3.1)
#> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.3.1)
#> tweenr 2.0.3 2024-02-26 [1] CRAN (R 4.3.3)
#> units 0.8-5.4 2024-06-03 [1] local
#> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.1)
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.2)
#> 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.1 2024-07-31 [1] CRAN (R 4.3.3)
#> xfun 0.45 2024-06-16 [1] CRAN (R 4.3.3)
#> xml2 1.3.6 2023-12-04 [1] CRAN (R 4.3.2)
#> yaml 2.3.9 2024-07-05 [1] CRAN (R 4.3.3)
#>
#> [1] C:/Users/user/AppData/Local/R/win-library/4.3
#> [2] C:/Program Files/R/R-4.3.1/library
#>
#> ────────────────────────────────────────────────────────────────────────────── Anyway, this is not an |
Tracked by tidyverse/ggplot2#6189 |
Describe the bug
Bug in
geom_edge_sf()
defined inv1.0
branch.Reproducible example
Created on 2024-11-13 with reprex v2.0.2
Expected behavior
No error
R Session Info
Session info
Same error exists with the current (f468053) Github version of ggplot2.
The text was updated successfully, but these errors were encountered: