I have data with Country level stats over time. I use facet_wrap()
to plot by Country but I want to order the plots based on only the most recent value (2015)
Here you go!
gather2 <- df1 %>%
mutate(Country=fct_reorder(Country, `2015`)) %>%
gather("Year", myValue, 2:4)
gg2 <- ggplot() +
geom_line(data = gather2, aes(x = Year, y = myValue, group = Country), size = 1.5, color = "orange") +
facet_wrap(~ Country, ncol = 3) +
theme(aspect.ratio = (35/50))
gg2