dipetkov / eems

Estimating Effective Migration Surfaces
GNU General Public License v2.0
102 stars 28 forks source link

Improving the plotting script #2

Closed BenjaminPeter closed 9 years ago

BenjaminPeter commented 9 years ago

I played around a bit with the idea of overlaying mean and variance in one plot. I ended up with ggplot. I currently have a working example, but it does not look nearly as nice as your figures:

s1

See https://github.com/BenjaminPeter/eems/tree/master/runeems_snps/plot and the tmp*pdf plots for what I ended up with.

Also, just to re-iterate map projections from my email: They can be used with the mapproj package. But everything has to be passed through a function to transform coordinates.

require(mapproj)
require(maps)

m <-function(x,y){
   return(mapproject(x,y,
                      orientation=c(90,150,0),
                      projection="mercator"))
}
limits <- m(c(-20,-40), c(-50,70))
plot(NA, xlim=limits$x, ylim=limits$y)
map(orientation=c(90,150,0),projection="mercator", wrap=T, add=T)

pt <- m(-87.6847, 41.8369)
points(pt$x, pt$y,col="red", pch=".", cex=10)
dipetkov commented 9 years ago

Now, by default, the contour plots of the migration and diversity estimates are in the Mercator projection. However, you can specify another projection using the 'projection' option and a PROJ.4 string. And you will need to install some extra R packages: 'rgdal', 'rgeos', 'raster' for the geospatial stuff and 'rworldmap', 'rworldxtra' for the world map in high resolution.