Populations map ======================================================== Publication populations map Making the italy part of the map, later save as a pdf and cut and insert in the next chunk of code as italy.png ```{r,eval=FALSE,tidy=TRUE} italy_map <- map("italy",bg='lightgrey',fill=TRUE,col='white') map('italy','Bolzano-Bozen',fill=TRUE,add=TRUE,col='darkgreen') ``` ```{r,eval=FALSE,tidy=TRUE} #adding a map or a picture install.packages("maps") install.packages("mapdata") library(maps) library(mapdata) library(mapproj) #plotting on a png-better install.packages('png') library(png) pdf(file=paste("Populations_map.pdf"),height=8,width=10) ima <- readPNG("image.png") italy <- readPNG("italy.png") x_range <- range(0,70) y_range <- range(0,40) plot(1:2, type='n', main="Arabidopsis populations",xlim=x_range,ylim=y_range,axes=FALSE,ann=FALSE) lim <- par() rasterImage(ima, lim$usr[1], lim$usr[3], lim$usr[2], lim$usr[4]) grid() points(c(42,15,32,39,22),c(31,33,37,13,14),col=c('white','gray80','yellow','white','yellow'), pch=21,cex=4,lwd=5) text(42,30, labels = "Juval",pos=1,col='white',cex=2,lwd=2) text(15,32, labels = "Laatsch",pos=1,col="gray80",cex=2,lwd=2) text(32,36, labels = "Finail",pos=1,col="yellow",cex=2,lwd=2) text(39,12, labels = "Terz",pos=1,col="white",cex=2,lwd=2) text(22,13, labels = "Vioz/Coro",pos=1,col="yellow",cex=2,lwd=2) legend(72.8,4.06,lwd=2,box.lwd=1,xjust=1, legend=c('Laatsch','High altitude populations','Low altitude populations'),col=c('gray60','yellow','white'), border='black',bg='gray80') axis(1, at=10*0:7, c("10°18'","10°28'","10°38'","10°48'","10°58'","11°08'","11°18'","11°28'")) axis(2,at=8*0:5,c("46°08'","46°16'","46°24'","46°32'","46°40'","46°48'")) title(xlab="Longitude", col="black",cex.axis=0.1) title(ylab="Latitude", col="black",cex.axis=0.1) rasterImage(italy, lim$usr[1]+57, lim$usr[3]+28, lim$usr[2], lim$usr[4]) dev.off() ```