Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The error message "arguments have different crs" in gganimate indicates that the input data have different crs (coordinate reference system). This error occurs because the spatial objects have different geometries and the coordinate systems may not match. The solution is to ensure that all spatial objects used in the gganimate function have the same crs.

To resolve the error, first, check that all your input data with the sf object have the same crs. If not, reproject the data using the sttransform() function. Once this is done, ensure that all layers and animations use the same crs by adding the argument coordsf(crs = "your crs code") in each ggplot object, and set the specific crs code that you have used for your data. By doing this, gganimate will use the same crs for all layers involved in the animation process, and the "arguments have different crs" error will be resolved.