Re: [R] problems with levelplot and contourplot

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Wed 12 Oct 2005 - 07:09:22 EST

Tom Lenaerts wrote:
> I have to correct my previous reply.
>
> The changes you propose work The strange thing is that if I upload the
> R-script to
> produce the plot from file using
>
> source("/Users/tomlenaerts/Programming/ObjC/Tools/AllEE/build/EEcont.R")
>
> The script does not work.
>
> When I copy-past the script myself into the R-window and execute things
> work ok.
> Any explanation for this?
>

Yes. See FAQ 7.22.

--sundar

> Tom
>
> -------------------------------------------------------------------------------------------------
>
> Tom Lenaerts (tlenaert at ulb.ac.be) http://www.tomlenaerts.tk/
> Postdoc Researcher @ IRIDIA-Universite Libre de Bruxelles-Belgium
> Guest Professor @ DINF-Vrije Uiversiteit Brussel-Belgium
> On 11 Oct 2005, at 22:26, Sundar Dorai-Raj wrote:
>
>
>
> 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
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Oct 12 07:13:16 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:41:27 EST