Re: [R] Problem with filled.contour/image

About this list Date view Thread view Subject view Author view Attachment view

From: Petr Pikal (petr.pikal@precheza.cz)
Date: Thu 06 May 2004 - 20:18:18 EST


Message-id: <409A2D0A.20356.FBAAC2@localhost>

Hi

Hi

x,y are supposed to be vectors with lengths n and m and the matrix is supposed to
have dimensions n,m

> ?image
> data(volcano)
> x <- 10*(1:nrow(volcano))
> y <- 10*(1:ncol(volcano))
> image(x, y, volcano, col = terrain.colors(100), axes = FALSE)
> length(x)
[1] 87
> length(y)
[1] 61
> dim(volcano)
[1] 87 61

did you get similar figures for your data?

Cheers
Petr

On 6 May 2004 at 10:41, Laura Quinn wrote:

> 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=TRU
> E)
>
> 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
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal@precheza.cz

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:08 EST