plotly / plotly/plotly.R

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

Open
#1,923 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducible R example in the issue and compare how ggplotly handles geom_sf layers with the frame aesthetic. The StackOverflow reproduction is the only referenced investigation; done means the map's changing pop_est values visibly update across the 2010 and 2011 animation frames.

Written by the indexing model from the issue text.

Assessment

Tech stack
plotly, r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.