geofacet
geofacet copied to clipboard
Global bug for all grids?
I have just rerun older code, and I am unable to reproduce even the example maps. Some data are completely missing, and some backgrounds are positioned at grid locations where they shouldn't be.
ggplot(state_unemp, aes(year, rate)) +
geom_line() +
facet_geo(~ state, grid = "us_state_grid2") +
scale_x_continuous(labels = function(x) paste0("'", substr(x, 3, 4))) +
ylab("Unemployment Rate (%)")
Same happening for EU
ggplot(eu_gdp, aes(year, gdp_pc)) +
geom_line(color = "steelblue") +
facet_geo(~ name, grid = "eu_grid1", scales = "free_y") +
scale_x_continuous(labels = function(x) paste0("'", substr(x, 3, 4))) +
ylab("GDP Per Capita in Relation to EU Index (100)") +
theme_bw()
> sessionInfo()
R version 4.5.1 (2025-06-13 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26200)
Matrix products: default
LAPACK version 3.12.1
locale:
[1] LC_COLLATE=Spanish_Spain.utf8
[2] LC_CTYPE=Spanish_Spain.utf8
[3] LC_MONETARY=Spanish_Spain.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.utf8
time zone: Europe/Madrid
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
other attached packages:
[1] geofacet_0.2.4 lubridate_1.9.4 forcats_1.0.1
[4] stringr_1.5.2 dplyr_1.1.4 purrr_1.1.0
[7] readr_2.1.5 tidyr_1.3.1 tibble_3.3.0
[10] ggplot2_4.0.0 tidyverse_2.0.0
loaded via a namespace (and not attached):
[1] rappdirs_0.3.3 generics_0.1.4
[3] class_7.3-23 KernSmooth_2.23-26
[5] lattice_0.22-7 stringi_1.8.7
[7] hms_1.1.4 magrittr_2.0.4
[9] grid_4.5.1 timechange_0.3.0
[11] RColorBrewer_1.1-3 rnaturalearth_1.1.0
[13] ggrepel_0.9.6 processx_3.8.6
[15] pkgbuild_1.4.8 e1071_1.7-16
[17] DBI_1.2.3 gridExtra_2.3
[19] ps_1.9.1 geogrid_0.1.2
[21] scales_1.4.0 httr2_1.2.1
[23] cli_3.6.5 crayon_1.5.3
[25] rlang_1.1.6 units_1.0-0
[27] bit64_4.6.0-1 remotes_2.5.0
[29] withr_3.0.2 parallel_4.5.1
[31] tools_4.5.1 tzdb_0.5.0
[33] curl_7.0.0 vctrs_0.6.5
[35] R6_2.6.1 proxy_0.4-27
[37] lifecycle_1.0.4 classInt_0.4-11
[39] bit_4.6.0 vroom_1.6.6
[41] archive_1.1.12 pkgconfig_2.0.3
[43] desc_1.4.3 callr_3.7.6
[45] pillar_1.11.1 gtable_0.3.6
[47] glue_1.8.0 Rcpp_1.1.0
[49] sf_1.0-21 tidyselect_1.2.1
[51] rstudioapi_0.17.1 dichromat_2.0-0.1
[53] farver_2.1.2 labeling_0.4.3
[55] compiler_4.5.1 S7_0.2.0
[57] sp_2.2-0
It seems the same as reported already here https://github.com/hafen/geofacet/issues/448
Just pushed a fix to the main branch. Can you try it out and see if it fixes your issue?