Guest User

Untitled

a guest
Jun 18th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. library(ggplot2)
  2.  
  3. update <- c(2030, 3156)
  4. original <- c(1414, 2523)
  5. inegi <- c(2567, NA)
  6.  
  7. hom <- data.frame(year = 2008:2009,
  8. updates = update,
  9. original = original,
  10. inegi = inegi)
  11.  
  12.  
  13. ggplot(hom, aes(factor(year), updates, group = 1)) +
  14. scale_colour_discrete("Source") +
  15. geom_line(aes(color = "SNSP")) +
  16. geom_line(aes(factor(year), original, color = "SNSP"),
  17. linetype = 2) +
  18. geom_point(aes(factor(year), inegi, color = "INEGI")) +
  19. ylim(0, max(update)) +
  20. xlab("year") +
  21. ylab("number of homicides") +
  22. opts(title = "Discrepancies in Homicide Data for the State of Chihuahua") +
  23. annotate("text", x = "2009", y = 2523, label = "original SNSP",
  24. hjust = 0) +
  25. annotate("text", x = "2009", y = 3156, label = "updated SNSP",
  26. hjust = 0) +
  27. annotate("text", x = "2008", y = 2567, label = "INEGI",
  28. hjust = 1.06)
Add Comment
Please, Sign In to add comment