Ohh I got your point Deepayan, thats a stupid question from me. I can easilty rbind my four datasets, distuingusing them by a new variable, say "type", and then instead of plotting a 2D image, I can use a conditioning variable to plot a 3D image and achieve what I what.
I'm sorry about this, thanks a lot! Kim On Fri, Mar 19, 2010 at 6:24 AM, Deepayan Sarkar <deepayan.sar...@gmail.com>wrote: > On Fri, Mar 19, 2010 at 8:37 AM, Kim Jung Hwa <kimhwamaill...@gmail.com> > wrote: > > Hi David, > > > > Thank you for your reply. I'm sorry if I've misconveyed my question: here > it > > goes again: > > > > *** I want a common "main title" and a common "legend" after I > > output/print four different lattice plots on a single .wmf or .pdf > file*** > > Somewhat as in this image: > > > > > http://www.ncl.ucar.edu/Training/Workshops/Exercises/Images/panel_ex08.png > > But this is also not a good example (assuming that you really want > what you claim you want) because it is precisely the type of plot > multipanel Trellis graphics are designed for. For example, see the > last example in example(levelplot). In the case of your toy example, > > p2[c(1, 1)] > > So you still need to convince us of the need for what you want. > However, if you do really need it, you will need to use some > lower-level grid functions (basically, create a viewport and put the > two lattice plots inside, then add the main title and legend using > grid directly). > > -Deepayan > > > # R code: > > library(lattice) > > p1 <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, > > type = "a", main="Remove this title and legend on right", > > auto.key = list(space = "right", points = FALSE, lines = TRUE)) > > p2 <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, > > type = "a", main="Need a single / legend", > > auto.key = list(space = "right", points = FALSE, lines = TRUE)) > > > > win.metafile("Rplot%02d.wmf", width=12, height=8) > > print(p1, split=c(1,1,2,2), more=TRUE) > > print(p2, split=c(1,2,2,2), more=TRUE) > > print(p1, split=c(2,1,2,2), more=TRUE) > > print(p2, split=c(2,2,2,2)) > > dev.off() > > Thanks, > > Kim > > > > > > On Thu, Mar 18, 2010 at 10:21 PM, David Winsemius < > dwinsem...@comcast.net>wrote: > > > >> > >> On Mar 18, 2010, at 10:10 PM, Kim Jung Hwa wrote: > >> > >> Hi All, > >>> > >>> Can anyone please help me with getting a "single title" and "legend" > for > >>> both the plots in the following R code. I'll eventually be using .wmf > >>> file. > >>> > >> > >> This is either incredibly simple or you have not explained what you > reall > >> want. Not being on windos I would not be making a win-metafile but this > pdf > >> appears to be doing what you ask: > >> > >> ttl <- "Some random text" > >> > >> p1 <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, > >> type = "a", main=ttl, > >> > >> auto.key = list(space = "right", points = FALSE, lines = TRUE)) > >> p2 <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, > >> type = "a", main=ttl, > >> > >> auto.key = list(space = "right", points = FALSE, lines = TRUE)) > >> > >> pdf("Rplot%02d.pdf", width=12, height=8) > >> > >> print(p1, split=c(1,1,2,2), more=TRUE) > >> print(p2, split=c(1,2,2,2), more=TRUE) > >> print(p1, split=c(2,1,2,2), more=TRUE) > >> print(p2, split=c(2,2,2,2)) > >> dev.off() > >> > >> > >>> # R code: > >>> library(lattice) > >>> p1 <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, > >>> type = "a", main="Same title / legend", > >>> auto.key = list(space = "right", points = FALSE, lines = TRUE)) > >>> p2 <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, > >>> type = "a", main="Same title / legend", > >>> auto.key = list(space = "right", points = FALSE, lines = TRUE)) > >>> > >>> win.metafile("Rplot%02d.wmf", width=12, height=8) > >>> print(p1, split=c(1,1,2,2), more=TRUE) > >>> print(p2, split=c(1,2,2,2), more=TRUE) > >>> print(p1, split=c(2,1,2,2), more=TRUE) > >>> print(p2, split=c(2,2,2,2)) > >>> dev.off() > >>> > >>> Thanks in advance, > >>> Kim > >>> > >>> [[alternative HTML version deleted]] > >>> > >>> ______________________________________________ > >>> R-help@r-project.org mailing list > >>> https://stat.ethz.ch/mailman/listinfo/r-help > >>> PLEASE do read the posting guide > >>> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > <http://www.r-project.org/posting-guide.html> > >>> and provide commented, minimal, self-contained, reproducible code. > >>> > >> > >> David Winsemius, MD > >> West Hartford, CT > >> > >> > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > > and provide commented, minimal, self-contained, reproducible code. > > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.