Session Ready
Exercise

Plotting the baseline

You can use different data sets for different layers in plotly, just like you can in ggplot2. This is a useful strategy when you want to display a baseline time point (or group) in an animation. In this exercise, your task is to create an animated scatterplot of housing price index against real GDP, keeping the 1997 data points in the background.

Instructions
100 XP
  • Add static points representing the data from 1997 (found in us1997) as the first layer. Set the color of these points to "gray60" and the opacity to 0.5.
  • Add a second trace to create an animated scatterplot over time (year) using the entire us_economy data frame. Remember that each point represents a state in any given year