Animation of changing values of map over time using geom_sf and ggplotly does not work
Open
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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