Get startedGet started for free

What's the frame?

Suppose you wish to create an animated scatterplot of the housing price index (house_price) against a state's real GDP (gdp) over the years. What variable should be mapped to the frame aesthetic?

Below are the first 10 rows of this data set.

# A tibble: 3,213 x 9
   state  year    gdp employment home_owners house_price population region division
   <chr> <dbl>  <dbl>      <dbl>       <dbl>       <dbl>      <dbl> <chr>  <chr>   
 1 AK     1997 42262.         NA        67.2        159.       609. West   Pacific 
 2 AK     1998 41157.         NA        66.3        164.       615. West   Pacific 
 3 AK     1999 40722.         NA        66.4        169.       620. West   Pacific 
 4 AK     2000 39517.         NA        66.4        172.       628. West   Pacific 
 5 AK     2001 40974.         NA        65.3        181.       634. West   Pacific 
 6 AK     2002 42881          NA        67.1        191.       642. West   Pacific 
 7 AK     2003 42150.     307300        70          200.       648. West   Pacific 
 8 AK     2004 43735.     304900        67.2        220.       659. West   Pacific 
 9 AK     2004 43735.     305100        67.2        220.       659. West   Pacific 
10 AK     2004 43735.     306000        67.2        220.       659. West   Pacific 
# ... with 3,203 more rows

This exercise is part of the course

Intermediate Interactive Data Visualization with plotly in R

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise