Tom Lenaerts wrote:> Hello,
>
>
> Using the following code i want to make a level or contourplot of some
> data that I produced
>
> library(grid);library(lattice);
No need to explicitly load "grid". This is done when attaching
"lattice". Also, you do not need any ";" at the end of any
lines.
> mydata <- read.table("avgee.dat");
> mymat <- as.matrix(mydata);
> mymat <-t(mymat)
> vals<-as.vector(mymat);
> conc<-c(0.0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5);
> a<- c(0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5,5.0,
> 7.5,10, 25, 50, 75, 100);
> grid<-expand.grid(x=conc, y=a);
> levelplot(vals ~ conc * a, grid, region=TRUE, cuts=20);
Don't you mean
levelplot(vals ~ x * y, grid, region=TRUE, cuts=20)
Your data.frame "grid" has columns "x" and "y",
not "conc" and "a".
>
> When I do this get a blank output window and the following warnings
>
> Warning messages:
> 1: longer object length
> is not a multiple of shorter object length in: is.na(x) | is.na(y)
> 2: longer object length
> is not a multiple of shorter object length in: id.na | is.na(var)
> 3: longer object length
> is not a multiple of shorter object length in: id & if
> (is.shingle(var)) ((var >= levels(var)[[cond.current.level[i]]][1])
&
> >
>
> I've examined this mailinglist and the web and tried the examples other
> people suggested. They seem to work.
> Yet, my code seems the same as
>
> a <-1:10
> b <-11:20
> j <- rnorm(100)
> grid<-expand.grid(a = a, b = b)
> levelplot(j~a*b, grid)
>
> (from a previous mail)
>
>
> and it does not work.
>
> Can anybody tell me what I'm doing wrong? Furthermore as you ight
> notice the data in a is in log-scale so I want the y-axis of the plot
> in logscale.
>
To print y in log-scale, add the following:
levelplot(..., scale = list(y = list(log = TRUE)))
HTH,
--sundar