title: Overlaying world map on a image plot in R
body: <p>I am trying to plot a global map using latitude, longitude and grid data in R. For this I am using image and image.plot functions. Additionally I need to overlay global coastline for land area. However I am not sure how to place the map exactly over my image of gridded data. Map is appearing bit shifted to the left in the console and that part is not visible either. See sample code below with random grid data.</p>
  
  <pre><code>remove(list=ls())
  
  library(fields)
  
  library(maps)
  
  grid_lon&lt;-c(0.5:1:359.5)
  
  grid_lat&lt;-c(-89.5:89.5)
  
  temp1&lt;-matrix(data = rexp(200, rate = 10), nrow = 360, ncol = 180)#random matrix
  
  zlim=c(0,0.25)
  
  par(oma=c( 3,0,0,0))# c(bottom, left, top, right)#plot margins
  
  image(grid_lon,grid_lat,temp1,axes=FALSE,xlab='',ylab='')
  
  map("world", fill=TRUE, col="white", bg="white", ylim=c(-90, 90),add=TRUE)
  
  title(main ='Main title')
  image.plot(zlim=zlim,legend.only=TRUE,horizontal=TRUE,legend.mar=0.4,legend.shrink=0.4,legend.width=0.4,nlevel=64,axis.args = list(cex.axis =1,at=zlim, labels=zlim,mgp=c(1, 0, 0),tck=0),smallplot=c(.25,.72, 0,.030),
      legend.args=list( text=expression(textstyle(atop('anomaly',
      paste('(meters)')),cex.main=1.2)),cex=1.2, side=1, line=1.6)
      )#end image.plot
  
  box()
  </code></pre>