【问题标题】:gganimate error: Error in seq.default(range[1], range[2], length.out = nframes) : 'from' must be a finite numbergganimate 错误:seq.default(range[1], range[2], length.out = nframes) 中的错误:'from' 必须是有限数
【发布时间】:2021-08-11 09:42:46
【问题描述】:

我正在尝试制作以下数据的动画累积地图:

structure(list(station_install_date = structure(c(16684, 16684, 
16684, 16684, 16684, 16684), class = "Date"), lat = c(37.548645, 
37.549561, 37.550007, 37.550629, 37.552746, 37.554951), long = c(126.912827, 
126.905754, 126.914825, 126.914986, 126.918617, 126.910835), 
    capa_sum = c(10L, 5L, 5L, 13L, 10L, 14L)), row.names = c(NA, 
-6L), groups = structure(list(station_install_date = structure(c(16684, 
16684, 16684, 16684, 16684, 16684), class = "Date"), lat = c(37.548645, 
37.549561, 37.550007, 37.550629, 37.552746, 37.554951), .rows = structure(list(
    1L, 2L, 3L, 4L, 5L, 6L), ptype = integer(0), class = c("vctrs_list_of", 
"vctrs_vctr", "list"))), row.names = c(NA, -6L), class = c("tbl_df", 
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df", 
"tbl_df", "tbl", "data.frame"))

我的代码如下:

seoul <- get_googlemap("Seoul, South Korea", zoom=11, maptype = "roadmap")
ggmap(seoul) + 
  geom_point(data = install_time_df, aes(x = long, y = lat), color = "red", alpha = 0.3) +
  transition_time(station_install_date) +
  ease_aes("linear")

但是,我不断收到错误消息:

Error in seq.default(range[1], range[2], length.out = nframes) : 
  'from' must be a finite number

【问题讨论】:

    标签: r ggplot2 error-handling gganimate


    【解决方案1】:

    试试:

    p2<- ggmap(seoul) + 
      geom_point(data = install_time_df, aes(x = long, y = lat), color = "red", alpha = 0.3) +
      transition_manual(station_install_date, cumulative = TRUE) +
      ease_aes("linear")
    
    anim2<- animate(p2, renderer = gifski_renderer())
    anim_save("C:\\Users\\82104\\Desktop\\따릉이\\anim2.gif", animation = anim2)
    

    【讨论】:

      猜你喜欢
      • 2020-05-05
      • 1970-01-01
      • 1970-01-01
      • 2021-04-03
      • 1970-01-01
      • 2020-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多