plotly / plotly/plotly.R

Animation of changing values of map over time using geom_sf and ggplotly does not work

未关闭
#1,923 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

This is a copy of my Question on StackOverflow.


I try to animate changing values on a map over time using ggplot with geom_sf and ggplotly. In the following example the map does not change over time.

library(sf)
library(tidyverse)
library(plotly)
library("rnaturalearth")
library("rnaturalearthdata")

world <- ne_countries(scale = "medium", returnclass = "sf")
world$year <- 2010

world2 <- world
world2$year <- 2011
world2$pop_est <- 1000000

world3 <- bind_rows(world, world2)

# ggplot(data = world) +
#   geom_sf(aes(fill = pop_est))

plt <- ggplot(world3, aes(fill = pop_est, frame = year)) +
  geom_sf() 

ggplotly(plt)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中可复现的 R 示例开始,并比较 ggplotly 如何处理带有 frame aesthetic 的 geom_sf 图层。StackOverflow 复现是唯一被引用的调查;当地图中变化的 pop_est 值在 2010 和 2011 动画帧之间可见地更新时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
plotly, r
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。