[R] levelplot in lattice
adschai at optonline.net
adschai at optonline.net
Thu Jun 28 04:37:04 CEST 2007
Sorry. My email editor from my ISP always screws up the text after sending out. Below is my response to you (in plain text).
Thank you Deepayan. Let's do the following exercise to reproduce the problem I'm facing. In the following code, I tried to have plot.rw1 and plot.rw2 shows in two separate rows on my plot windows. However, after the call to the 2nd levelplot, plot of plot.rw2 replace my first plot and the result shows only 1 row on my windows. Any lights on this would be really appreciated. Thank you
x <- seq(0.1,1,0.1);
y <- seq(0.1,1,0.1);
dat <- rnorm(4*length(x)*length(y));
Pa.dat <- expand.grid(x,y);
Pa.dat$z <- dat[1:100];
Pa.dat$cond <- "Pa";
plot.rw1 <- Pa.dat;
Pb.dat <- expand.grid(x,y);
Pb.dat$z <- dat[101:200];
Pb.dat$cond <- "Pb";
plot.rw1 <- rbind(plot.rw1, Pb.dat);
names(plot.rw1) <- c("x","y","z","cond");
Days1.dat <- expand.grid(x,y);
Days1.dat$z <- dat[201:300];
Days1.dat$cond <- "Day Work";
plot.rw2 <- Days1.dat;
Days2.dat <- expand.grid(x,y);
Days2.dat$z <- dat[301:400];
Days2.dat$cond <- "Day Rest";
plot.rw2 <- rbind(plot.rw2, Days2.dat);
names(plot.rw2) <- c("x","y","z","cond");
windows();
par(mfrow=c(2,1));
levelplot(z ~ x*y|cond, plot.rw1);
levelplot(z ~ x*y|cond, plot.rw2);
----- Original Message -----From: adschai at optonline.netDate: Wednesday, June 27, 2007 9:34 pmSubject: Re: [R] levelplot in latticeTo: Deepayan Sarkar Cc: r-help at stat.math.ethz.ch> Thank you Deepayan. Let's do the following exercise to reproduce > the problem I'm facing. In the following code, I tried to have > plot.rw1 and plot.rw2 shows in two separate rows on my plot > windows. However, after the call to the 2nd levelplot, plot of > plot.rw2 replace my first plot and the result shows only 1 row > on my windows. Any lights on this would be really appreciated. > Thank you.x <- seq(0.1,1,0.1);y <- seq(0.1,1,0.1);dat <- > rnorm(4*length(x)*length(y));Pa.dat <- expand.grid(x,y);Pa.dat$z > <- dat[1:100];Pa.dat$cond <- "Pa";plot.rw1 <- Pa.dat;Pb.dat <- > expand.grid(x,y);Pb.dat$z <- dat[101:200];Pb.dat$cond <- > "Pb";plot.rw1 <- rbind(plot.rw1, Pb.dat);names(plot.rw1) <- > c("x","y","z","cond");Days1.dat <- expand.grid(x,y);Days1.dat$z > <- dat[201:300];Days1.dat$cond <- "Day Work";plot.rw2 <- > Days1.dat;Days2.dat <- expand.grid(x,y);Days2.dat$z <- > dat[301:400];Days2.dat$cond <- "Day Rest";plot.rw2 <- > rbind(plot.rw2, Days2.dat);names(plot.rw2) <- > c("x","y","z","cond");windows();pa! r(mfrow=c(2,1));levelplot(z > ~ x*y|cond, plot.rw1);levelplot(z ~ x*y|cond, plot.rw2);----- > Original Message -----From: Deepayan Sarkar Date: Wednesday, > June 27, 2007 7:00 pmSubject: Re: [R] levelplot in latticeTo: > "adschai at optonline.net" Cc: r-help at stat.math.ethz.ch> On > 6/27/07, adschai at optonline.net wrote:> > Hi,> >> > I'm new to > lattice. So please kindly be patient with me.> > I'm trying to > arrange groups of levelplots into 3 rows as follows:> >> > Row1: > Probabilities as functions of x and y, and conditioned > on an > event factor vector factor("a","b","c")> >> > Row2: Number of > days as functions of x and y, and conditioned > on, again the > same event factor("a","b","c")> >> > Row2: Costs as functions of > x and y, and conditioned on, > again the same event > factor("a","b","c")> >> > I tried the following:> >> > > windows();> > par(mfrow=c(3,1));> > levelplot(z ~ x*y|events, > probDat);> > levelplot(z ~ x*y|events, daysDat);> > levelplot(z > ~ x*y|events, costDat);> >> > It does no!> t do what I want. It replace the previous plot every > time I > call a n> ew levelplot. I can't put them into the same > matrix and plot > them all at once because the scale of each data > type is very > different, i.e.g probability=c(0,1), days=c(0,10), > etc. I'm > wondering if you could suggest a way to solve this problem.> >> > > It all depends on the details. Please give a small > reproducible > example.> > Also, if I would like to put in > mathematical notation on the > top strip of the plot instead of > using text in my events factor > vector, what can I do?> > Use > expressions (see ?plotmath). Again, please give details.> > -Deepayan>> > [[alternative HTML version deleted]]> > ______________________________________________> R-help at 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> and provide commented, minimal, self-contained, reproducible code.>
More information about the R-help
mailing list