cran / usmap

:exclamation: This is a read-only mirror of the CRAN R package repository. usmap — US Maps Including Alaska and Hawaii. Homepage: https://usmap.dev Report bugs for this package: https://github.com/pdil/usmap/issues
0 stars 1 forks source link

`plot_usmap` giving an error with ggplot element hierarchy #3

Closed cmansoo closed 5 months ago

cmansoo commented 5 months ago

Hello, I recently ran into this error running the plot_usmap function. I am not quite sure what the issue is. Could you help me fix this? Thank you

library(usmap)
plot_usmap(data=statepop, values="pop_2022")
#> Error in `mapply()`:
#> ! The `legend.justification.inside` theme element is not defined in the
#>   element hierarchy.
#> 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("goofy-coney_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.         ├─knitr:::handle_error(...)
#>  17.         │ └─base::withCallingHandlers(...)
#>  18.         ├─base::withCallingHandlers(...)
#>  19.         ├─knitr:::process_group(group)
#>  20.         └─knitr:::process_group.block(group)
#>  21.           └─knitr:::call_block(x)
#>  22.             └─knitr:::block_exec(params)
#>  23.               └─knitr:::eng_r(options)
#>  24.                 ├─knitr:::in_input_dir(...)
#>  25.                 │ └─knitr:::in_dir(input_dir(), expr)
#>  26.                 └─knitr (local) evaluate(...)
#>  27.                   └─evaluate::evaluate(...)
#>  28.                     └─evaluate:::evaluate_call(...)
#>  29.                       ├─evaluate (local) handle(...)
#>  30.                       │ └─base::try(f, silent = TRUE)
#>  31.                       │   └─base::tryCatch(...)
#>  32.                       │     └─base (local) tryCatchList(expr, classes, parentenv, handlers)
#>  33.                       │       └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
#>  34.                       │         └─base (local) doTryCatch(return(expr), name, parentenv, handler)
#>  35.                       ├─base::withCallingHandlers(...)
#>  36.                       ├─base::withVisible(value_fun(ev$value, ev$visible))
#>  37.                       └─knitr (local) value_fun(ev$value, ev$visible)
#>  38.                         └─knitr (local) fun(x, options = options)
#>  39.                           ├─base::withVisible(knit_print(x, ...))
#>  40.                           ├─knitr::knit_print(x, ...)
#>  41.                           └─knitr:::knit_print.default(x, ...)
#>  42.                             └─evaluate (local) normal_print(x)
#>  43.                               ├─base::print(x)
#>  44.                               └─ggplot2:::print.ggplot(x)
#>  45.                                 ├─ggplot2::ggplot_gtable(data)
#>  46.                                 └─ggplot2:::ggplot_gtable.ggplot_built(data)
#>  47.                                   └─ggplot2:::plot_theme(plot)
#>  48.                                     └─base::mapply(validate_element, theme, names(theme), MoreArgs = list(element_tree = get_element_tree()))
#>  49.                                       └─ggplot2 (local) `<fn>`(dots[[1L]][[98L]], dots[[2L]][[98L]], element_tree = `<named list>`)
#>  50.                                         └─cli::cli_abort(...)
#>  51.                                           └─rlang::abort(...)

Created on 2024-04-10 with reprex v2.0.2

Also including my sessionInfo

sessionInfo()
#> R version 4.3.2 (2023-10-31 ucrt)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 11 x64 (build 22631)
#> 
#> Matrix products: default
#> 
#> 
#> locale:
#> [1] LC_COLLATE=English_United States.utf8 
#> [2] LC_CTYPE=English_United States.utf8   
#> [3] LC_MONETARY=English_United States.utf8
#> [4] LC_NUMERIC=C                          
#> [5] LC_TIME=English_United States.utf8    
#> 
#> time zone: America/New_York
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.33     fastmap_1.1.1     xfun_0.41         glue_1.6.2       
#>  [5] knitr_1.45        htmltools_0.5.7   rmarkdown_2.25    lifecycle_1.0.4  
#>  [9] cli_3.6.1         reprex_2.0.2      withr_2.5.2       compiler_4.3.2   
#> [13] rstudioapi_0.15.0 tools_4.3.2       evaluate_0.23     yaml_2.3.7       
#> [17] rlang_1.1.2       fs_1.6.3

Created on 2024-04-10 with reprex v2.0.2

gaborcsardi commented 5 months ago

Hi, this is a read only mirror of CRAN, please see the package authors in the DESCRIPTION file. Look for Maintainer, BugReports and URL. Thanks!