dcl-docs / data-vis

Data Visualization
https://dcl-data-vis.stanford.edu
Other
3 stars 6 forks source link

better way to order countries #9

Closed behrman closed 5 years ago

behrman commented 5 years ago

A preferable way to order countries by their last value:

southern_africa_countries %>% 
  mutate(name = fct_reorder2(name, year, life_expectancy)) %>% 
  ggplot(aes(year, life_expectancy, color = name)) +
  geom_vline(xintercept = 1994, color = "blue") +
  geom_line() +
  geom_point() +
  theme(legend.justification = "top") 
skaltman commented 5 years ago

I changed this in continuous-continuous and time-series!