Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. library(tidyverse)
  2.  
  3. df <- tribble(
  4. ~year, ~country, ~series1, ~series2,
  5. #--|--|--|----
  6. 2003, "USA", 8, 5,
  7. 2004, "USA", 9, 6,
  8. 2005, "USA", 11, 7,
  9. 2006, "USA", 10, 8,
  10. 2007, "USA", 11, 4,
  11. 2008, "USA", 14, 10,
  12. 2009, "USA", 16, 12,
  13. 2010, "USA", 12, 8,
  14. 2011, "USA", 12, 13,
  15. 2012, "USA", 13, 10,
  16. 2013, "USA", 11, 5,
  17. 2005, "FRA", 5, 6,
  18. 2006, "FRA", 6, 8,
  19. 2007, "FRA", 5, 7,
  20. 2008, "FRA", 4, 8,
  21. 2009, "FRA", 9, 11,
  22. 2010, "FRA", 7, 9,
  23. 2011, "FRA", 14, 11,
  24. 2012, "FRA", 7, 11,
  25. 2013, "FRA", 6, 6,
  26. 2014, "FRA", 5, 7,
  27. 2015, "FRA", 4, 5
  28. )
  29.  
  30. ggplot(df, aes(x = year)) +
  31. geom_line(aes(y = series1, color = "First series")) +
  32. geom_line(aes(y = series2, color = "Second series")) +
  33. facet_wrap(~country) +
  34. annotate("text", x = 2014, y = 13, label = "First series") +
  35. annotate("text", x = 2014, y = 8, label = "Second series")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement