Advertisement
Guest User

South American neotoma db sites

a guest
Oct 29th, 2013
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.76 KB | None | 0 0
  1. ##  Prior to October 30, 2013 you need to run this code:
  2. #  To install for the first time, this may require also installing
  3. #  RTools.  An error message will be returned here if this is the case:
  4. install.packages("devtools")
  5.  
  6. #  If the above line runs okay, then the rest should run fine.  If not then either you need to run R as
  7. #  an administrator, you need to check your internet connection, or you need to install RTools.  To download
  8. #  and install RTools follow this link:  http://cran.r-project.org/bin/windows/Rtools/
  9. require(devtools)
  10. install_github("neotoma", "ropensci")
  11.  
  12. ##  After October 30, 2013 this should be sufficient:
  13. install.packages('neotoma', repos='http://R-Forge.R-project.org', type='source')
  14.  
  15. library(ggplot2)
  16. library(ggmap)
  17.  
  18.  
  19. #  Gt the lines for the world map:
  20. map <- map_data('world')
  21. map <- subset(map, map$long > -90 & map$long < -30)
  22. map <- subset(map, map$lat > -52.8 & map$lat < 11)
  23.  
  24. map <- as.data.frame(map)
  25.  
  26. sa.sites <- get_sites(loc=c(-109.5, -60, -25, 14))
  27.  
  28. #  Get rid of one site from off the coast of Nicaragua:
  29. sa.sites <- sa.sites[-73,]
  30.  
  31. sa.map <- get_map(location = c(-67, -24), maptype='satellite', crop=FALSE, zoom=3)
  32.  
  33. ggmap(sa.map) +
  34.   geom_path(data=map, aes(long, lat, group=group), alpha=0.6) +
  35.   xlab('') + ylab('') +
  36.   geom_point(data=sa.sites, aes(x = LongitudeWest, y = LatitudeNorth),
  37.              size = 4, color='red', alpha=0.6) +
  38.   scale_x_continuous(limits=c(-90, -30), expand=c(0,0)) +
  39.   scale_y_continuous(limits=c(-56, 11)) +
  40.   theme_bw() +
  41.   theme(text=element_text(family='serif', size = 12)) +
  42.   geom_vline(xintercept=seq(-80, -40, by = 10), color = 'gray50', alpha=0.4) +
  43.   geom_hline(yintercept=seq(-50, 0, by = 10), color = 'gray50', alpha=0.4)
  44.  
  45. ggsave(dpi=300, file='sa.neotoma.sat.pdf')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement