为什么动画情节比静态情节小?

Why is animation plot smaller than static plot?

下面的代码将星形变成了圆形。如果我只是绘制星星,那么大小就很好了。

ggplot(star1) +
  geom_sf(aes(geometry = geometry))

然而,动画最终变小了:

我该怎么做才能使动画与星星的静态图大小相同?

library(tidyverse)
library(gganimate)
library(transformr)

star1 <- sf::st_sfc(poly_star(n = 7, st = TRUE))
circle1 <- sf::st_sfc(poly_circle(st = TRUE))

star2 <- star1 + c(2, 0)
circle2 <- circle1 + c(2,0)

star1 <- data.frame(
  id = c(1, 2),
  geo = c(star1, star2)
)

circle2 <- data.frame(
  id = c(1, 2),
  geo = c(circle1, circle2)
)

morph <- tween_sf(star1, circle2,
                  ease = 'linear', 
                  nframes = 12, 
                  id = id)  

ani <- ggplot(morph) +
       geom_sf(aes(geometry = geometry)) +
       transition_time(time = .frame) +
       theme(legend.position = "none") 

show <- animate(ani, nframes = 30, fps = 30, 
                renderer = gifski_renderer(loop = FALSE), start_pause = 15)

show

输出动画大小的宽度和高度参数(以像素为单位)是 animate 的选项

animate(ani, nframes = 30, fps = 30, width = 900, 
          renderer = gifski_renderer(loop = FALSE), start_pause = 15)