title: How can I animate points on a spatial map with gganimate, sf, and ggplot2?
body: <p>I'm having some trouble with animating some points on a spatial map. For some reason, only about half of the points show up in the animation. In the static plot, I can clearly see all the points.</p>
  <p>How can I make sure that the gganimation shows all the points? Does gganimate not 'play nicely' with spatial maps?</p>
  <p>Does anyone have more experience with using gganimate and spatial plotting?
  I can reproduce the problem with an example dataset:</p>
  <pre><code>    library(sf)
      library(ggplot2)
      library(ggspatial)
      library(gganimate)
  
  ##Reading example data
      nc &lt;- st_read(system.file(&quot;shape/nc.shp&quot;, package=&quot;sf&quot;))
  
  ##Create new sf=variable of random points
      A &lt;- nc %&gt;% 
        st_sample(size = 30) %&gt;% 
        st_coordinates() %&gt;%
        as.data.frame()
  
  ##Create static map
      B &lt;- ggplot() +
        annotation_spatial(data=nc) +
        geom_point(data = A, aes(x=X, y=Y), size = 2, col = &quot;#3a6589&quot;)
  
  ##Create animation with points showing up one by one
      plot_anim &lt;- B +
        transition_states(states = Y, state_length = 0, wrap = FALSE) +
        enter_recolor(fill = &quot;#f0f5f9&quot;) +
        shadow_mark(past = TRUE, alpha = 1, fill = &quot;#3a6589&quot;)
  
  ##Render animation
      animate(plot_anim, fps = 40, end_pause = 60)
  </code></pre>