Skip to content

Issue with facets that have different starting year #357

Description

@SimonCoulombe

gganimate will show the wrong data for facets when a facet has a different starting year.

In the example below, country #1 has 1900-1940 data and country #2 has 1910-1940 data.
The country1 facet will show "year y data", while country #2 facet will show "year y+10 data.

file76d5740b42d6

library(tidyverse)
library(gganimate)


country1 <- tibble(year = seq(1900, 1939), country = "1")
country2 <- tibble(year = seq(1910, 1939), country = "2")

ages <- tibble(age = seq(1, 100))

data <- bind_rows(
  country1 %>% crossing(ages), 
  country2 %>% crossing(ages)) %>%
  mutate(value = year)

data %>% 
  ggplot(aes(x = age, y= value)) +
  geom_line() +
  facet_wrap(~ country) +
  transition_time(year) +
  labs(title = "year: {frame_time}") +
  ease_aes('linear') 

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions