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
and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT

______________________________________________
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.

Reply via email to