Guest User

Untitled

a guest
Nov 19th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 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 = series1, y = series2, color = country)) +
  31. geom_point() +
  32. geom_segment(aes(x = 4, xend=6, y = 11, yend=8),
  33. arrow = arrow(length = unit(0.5, "cm")))
Add Comment
Please, Sign In to add comment