Part 1

[You do not have to include any graphs here, but you can for your own notes if you wish!]

Part 2

[You do not have to include any graphs here, but you can for your own notes if you wish!]

Part 3: Your turn!

Using any data besides gapminder, create any animation you want (besides the ones I’ve included here). Your animations can be similar to Examples 1 and 2, but should include changes beyond plugging in different variables to the aes calls.

Everybody should submit an .rmd file with your animation. You should also turn in an HTML document (via RPubs) or use anim_save() to save your animation and turn it in alongside your .rmd file:

anim_save(FILENAME, animation = last_animation())

(for more info, use ?anim_save)

tesla <- read.csv("TSLA Historical Data-2.csv")
tesla$Date = as.Date(tesla$Date)
tesla2020 = filter(tesla, Date >= "2020-01-01" & Date <= "2020-12-31")

anim_1 <- 
  tesla2020 %>%
  ggplot(aes(x = Date, y = Price, ymin = Low, ymax = High)) +
   geom_line(color="seagreen4") +
   #stat_smooth(method = "loess", size = 0.5, color = "purple") +
   geom_ribbon(alpha = 0.4, fill = "seagreen2") +
   scale_x_date(date_labels = "%b\n%Y", date_breaks = "months") +
   labs(title = "Monthly Average Tesla Stock Price for 2020",
        caption = "Figure 1") +
   scale_y_continuous(labels=scales::dollar_format()) +
   theme(axis.title.x = element_blank(),
         axis.title.y = element_blank(),
         panel.background = element_rect(fill = "ivory"),
         text = element_text(family = "serif", size = 10)
         ) +
  transition_reveal(Date)  

animate(anim_1, nframes = 90)