[R] Problem with filled.contour/image

Laura Quinn laura at env.leeds.ac.uk
Thu May 6 11:41:12 CEST 2004


Quick question - I am having problems creating an orographic image
(similar to volcano example). I have created a map matrix with 3 columns
and over 2million rows.

I have created the matrix as follows:
map<-read.table("map.dat",header=TRUE)
long.grid<-sort(unique(map$long)
lat.grid<-sort(unique(map$lat)
map.matrix<-matrix(map$height,nrow=length(lat.grid),byrow=TRUE)

The problem is when I type the filled.contour
command I get the following error message:

filled.contour(long.grid,lat.grid,t(map.matrix),color=terrain.colors)

Error in filledcontour(as.double(x), as.double(y), z, as.double(levels),
:
        dimension mismatch

and when I try using the image function:

image(long.grid,lat.grid,t(map.matrix),col=terrain.colors(50),axes=TRUE)

I get the following error:

Error in image.default(long.grid, lat.grid, t(map.matrix), col =
terrain.colors(50),  :
        dimensions of z are not length(x)(+1) times length(y)(+1)

Each long and lat point are unique and have a corresponding height
component so these messages don't make any sense to me - can anyone please
advise?

Thanks

Laura




More information about the R-help mailing list