[R] how to plot a map on a non-rectilinear grid

Costas Douvis cdouvis at geol.uoa.gr
Mon Mar 17 11:22:49 CET 2008


Hi everyone

I have a matrix (let's say that it contains the values of elevation) and
want to plot its values on a map using a function such as image.plot or
filled.contour. The problem is that my grid is not rectilinear, it is
bended. Here is an example

lon<-matrix(0,20,25)
lat<-matrix(0,20,25)
elev<-matrix(0,20,25)
for (i in 1:20) {
for (j in 1:25) {
  lat[i,j]<-i+((j-12.5)^2)/100
  lon[i,j]<-j+((i-10)^2)/100
  elev[i,j]<-i+j
  }
  }

All 3 matrices have dimensions 20x25. How can I plot elev values in the
grid points defined by lat and lon?


-- 
Kostas Douvis
PhD Student
University of Athens - Department of Geography and Climatology
Academy of Athens - Research Centre for Atmospheric Physics and Climatology
email: cdouvis at geol.uoa.gr
tel: +30-210-8832048



More information about the R-help mailing list