-
Notifications
You must be signed in to change notification settings - Fork 309
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
Error: arguments have different crs #479
Comments
Is it a problem that is only happening to me? |
Happening for me as well using code that worked ~3 weeks ago |
I have the same issue tryin gto use it for aminating a ggplot map. |
I get the same error. Tried to run the solution referenced here https://stackoverflow.com/questions/68450668/how-can-i-animate-points-on-a-spatial-map-with-gganimate-sf-and-ggplot2 and I get ' Error: arguments have different crs' R version 4.2.3 (2023-03-15) Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): |
Just to provide a reprex for this error, which I'm seeing with gganimate version 1.0.8: # Load packages
library(gganimate)
#> Loading required package: ggplot2
library(sf)
#> Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
library(tidyverse)
# Load aggravated assaults, Chicago, 2010 to 2019
assaults <- read_csv("https://mpjashby.github.io/crimemappingdata/chicago_aggravated_assaults.csv.gz")
#> Rows: 148636 Columns: 5
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): loc_cat
#> dbl (3): longitude, latitude, district
#> dttm (1): date
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Calculate number of assaults each hour
hour_layers <- assaults |>
mutate(hour_name = hour(date)) |>
st_as_sf(coords = c("longitude", "latitude"), crs = "EPSG:4326")
# Create map
ggplot() +
geom_sf(data = hour_layers) +
transition_states(states = hour_name)
#> Error: arguments have different crs Created on 2023-04-05 with reprex v2.0.2 Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.2 (2022-10-31)
#> os macOS Ventura 13.3
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/London
#> date 2023-04-05
#> pandoc 2.19.2 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> bit 4.0.5 2022-11-15 [1] CRAN (R 4.2.0)
#> bit64 4.0.5 2020-08-30 [1] CRAN (R 4.2.0)
#> class 7.3-21 2023-01-23 [1] CRAN (R 4.2.0)
#> classInt 0.4-9 2023-02-28 [1] CRAN (R 4.2.0)
#> cli 3.6.1 2023-03-23 [1] CRAN (R 4.2.0)
#> colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.2.0)
#> crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.0)
#> curl 5.0.0 2023-01-12 [1] CRAN (R 4.2.0)
#> DBI 1.1.3 2022-06-18 [1] CRAN (R 4.2.0)
#> digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.0)
#> dplyr * 1.1.1 2023-03-22 [1] CRAN (R 4.2.0)
#> e1071 1.7-13 2023-02-01 [1] CRAN (R 4.2.0)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.0)
#> evaluate 0.20 2023-01-17 [1] CRAN (R 4.2.0)
#> fansi 1.0.4 2023-01-22 [1] CRAN (R 4.2.0)
#> farver 2.1.1 2022-07-06 [1] CRAN (R 4.2.0)
#> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.2.0)
#> forcats * 1.0.0 2023-01-29 [1] CRAN (R 4.2.0)
#> fs 1.6.1 2023-02-06 [1] CRAN (R 4.2.0)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.0)
#> gganimate * 1.0.8 2022-09-08 [1] CRAN (R 4.2.0)
#> ggplot2 * 3.4.1 2023-02-10 [1] CRAN (R 4.2.0)
#> gifski 1.6.6-1 2022-04-05 [1] CRAN (R 4.2.0)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0)
#> gtable 0.3.3 2023-03-21 [1] CRAN (R 4.2.2)
#> hms 1.1.2 2022-08-19 [1] CRAN (R 4.2.0)
#> htmltools 0.5.4 2022-12-07 [1] CRAN (R 4.2.0)
#> KernSmooth 2.23-20 2021-05-03 [1] CRAN (R 4.2.2)
#> knitr 1.42 2023-01-25 [1] CRAN (R 4.2.0)
#> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.0)
#> lpSolve 5.6.18 2023-02-01 [1] CRAN (R 4.2.0)
#> lubridate * 1.9.2 2023-02-10 [1] CRAN (R 4.2.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0)
#> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.0)
#> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.2.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0)
#> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.2.0)
#> progress 1.2.2 2019-05-16 [1] CRAN (R 4.2.0)
#> proxy 0.4-27 2022-06-09 [1] CRAN (R 4.2.0)
#> purrr * 1.0.1 2023-01-10 [1] CRAN (R 4.2.0)
#> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.2.0)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.2.0)
#> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.2.0)
#> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.2.0)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0)
#> Rcpp 1.0.10 2023-01-22 [1] CRAN (R 4.2.0)
#> readr * 2.1.4 2023-02-10 [1] CRAN (R 4.2.0)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.0)
#> rlang 1.1.0 2023-03-14 [1] CRAN (R 4.2.2)
#> rmarkdown 2.20 2023-01-19 [1] CRAN (R 4.2.0)
#> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.0)
#> scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0)
#> sf * 1.0-12 2023-03-19 [1] CRAN (R 4.2.0)
#> stringi 1.7.12 2023-01-11 [1] CRAN (R 4.2.0)
#> stringr * 1.5.0 2022-12-02 [1] CRAN (R 4.2.0)
#> styler 1.9.1 2023-03-04 [1] CRAN (R 4.2.0)
#> tibble * 3.2.1 2023-03-20 [1] CRAN (R 4.2.2)
#> tidyr * 1.3.0 2023-01-24 [1] CRAN (R 4.2.0)
#> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.0)
#> tidyverse * 2.0.0 2023-02-22 [1] CRAN (R 4.2.0)
#> timechange 0.2.0 2023-01-11 [1] CRAN (R 4.2.0)
#> transformr 0.1.4 2022-08-18 [1] CRAN (R 4.2.0)
#> tweenr 2.0.2 2022-09-06 [1] CRAN (R 4.2.0)
#> tzdb 0.3.0 2022-03-28 [1] CRAN (R 4.2.0)
#> units 0.8-1 2022-12-10 [1] CRAN (R 4.2.0)
#> utf8 1.2.3 2023-01-31 [1] CRAN (R 4.2.0)
#> vctrs 0.6.1 2023-03-22 [1] CRAN (R 4.2.0)
#> vroom 1.6.1 2023-01-22 [1] CRAN (R 4.2.0)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0)
#> xfun 0.37 2023-01-31 [1] CRAN (R 4.2.0)
#> yaml 2.3.7 2023-01-23 [1] CRAN (R 4.2.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
This appears to be a somewhat widespread bug. It seems it will happily animate a geom_sf with no crs, but when one is applied it spits the error out
|
Can confirm reprex reproduces the error here too. Sharing sessioninfo:
|
also experienceing this issue, bump |
Same issue here. |
Seeing this issue as well on a Relevant sessionInfo dump:
Edit: Found a temporary workaround. I downgraded
Unexpectedly, that did not resolve the issue. So I also downgraded
And now my animation is working again. |
Here's another reprex, but just adapting the
I believe the point where the crs is being dropped is here, with the call to The issue is that the call to
Actually, just checked, and the error is now occurring because
Interestingly enough, @thomasp85, would you like a pull-request to fix this? I think just adding |
I am not able to reproduce any of these issues. My guess is that this was fixed upstream, but can some of you confirm with the latest dev versions of the involved packages that it behaves as it should? |
Ah, yeah, should have included the package versions, sorry. Here's how I did this last time:
After restarting the R session and updating packages (looks like I had basically the most up-to-date versions), still getting the error:
Here's the full session info:
|
Sorry, here's this with
|
Thanks - this appears to be caused by changes in sf then... I'll investigate In any case it is a tweenr/transformr issue, but let us just keep the issue here |
Should be fixed in dev transformr now |
I still have the problem with the new versions. I have checked, The problem is not in gganimate but in transformr . transformr 0.1.3 works perfect |
same here ... old version works - new one breaks |
I can confirm @michaelschulte . After installing Version 1.6.3 of |
Confirmed re. issue, going to try the fix.. |
the unreleased version of |
I tried the fix but it seems to have stopped working in the last few weeks. Here's the package version: The code I am using (expected output is an animated map of the USA with colors corresponding to each states' minimum wage at the start of the year):
which produces the familiar error: Removing the Here's the
|
@ptr-64 I also just had this happen again on code that worked as of a week ago. When this first happened, I installed the old version of I'm not sure how I was able to produce gifs without explicitly calling Finally, after adding TL;DR: Here's how I fixed the return of the
|
@mecohn Your solution worked, but I had to install the older R version in a docker container. Also, I think one of the packages got updated because the code chunk I posted above worked this morning without issue. |
When using sf object
The text was updated successfully, but these errors were encountered: