Hi All, I need a file which I can import to MS Word, I'm trying win.metafile(), but it does not seem to support multiple print commands at once (please see below). Is there an alternative to get plots file which can be used in powerpoint/word? # R code: # this does not work; but same thing works with pdf() library(lattice) win.metafile("test.wmf") p1 <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, type = "a", auto.key list(space = "right", points = FALSE, lines = TRUE)) p2 <- xyplot(sunspot.year ~ 1700:1988, xlab = "", type = "l", scales = list(x = list(alternating = 2)), main = "Yearly Sunspots") print(p1, split=c(1,1,2,1), more=TRUE) print(p2, split=c(2,1,2,1)) dev.off() Can anyone help please, thanks, Kim [[alternative HTML version deleted]]
?win.metafile For win.metafile only one plot is allowed per file, and Windows seems to disallow reusing the file. So the *only* way to allow multiple plots is to use a parametrized filename as in the example. win.metafile("Rplot%02d.wmf", pointsize = 10) Notice the %02d in the file name. On Thu, Mar 18, 2010 at 12:36 PM, Kim Jung Hwa <kimhwamaillist@gmail.com>wrote:> Hi All, > > I need a file which I can import to MS Word, I'm trying win.metafile(), but > it does not seem to support multiple print commands at once (please see > below). Is there an alternative to get plots file which can be used in > powerpoint/word? > > # R code: > # this does not work; but same thing works with pdf() > library(lattice) > win.metafile("test.wmf") > p1 <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, > type = "a", > auto.key > list(space = "right", points = FALSE, lines = TRUE)) > > p2 <- xyplot(sunspot.year ~ 1700:1988, xlab = "", type = "l", > scales = list(x = list(alternating = 2)), > main = "Yearly Sunspots") > > print(p1, split=c(1,1,2,1), more=TRUE) > print(p2, split=c(2,1,2,1)) > dev.off() > > Can anyone help please, thanks, > 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> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]
You may want to check out the odfWeave package for another way to produce multiple plots in a format that can be easily saved as a word doc. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Kim Jung Hwa > Sent: Thursday, March 18, 2010 10:37 AM > To: r-help at r-project.org > Subject: [R] multiple print commands in win.metafile() > > Hi All, > > I need a file which I can import to MS Word, I'm trying win.metafile(), > but > it does not seem to support multiple print commands at once (please see > below). Is there an alternative to get plots file which can be used in > powerpoint/word? > > # R code: > # this does not work; but same thing works with pdf() > library(lattice) > win.metafile("test.wmf") > p1 <- xyplot(decrease ~ treatment, OrchardSprays, groups = rowpos, > type = "a", > auto.key > list(space = "right", points = FALSE, lines = TRUE)) > > p2 <- xyplot(sunspot.year ~ 1700:1988, xlab = "", type = "l", > scales = list(x = list(alternating = 2)), > main = "Yearly Sunspots") > > print(p1, split=c(1,1,2,1), more=TRUE) > print(p2, split=c(2,1,2,1)) > dev.off() > > Can anyone help please, thanks, > Kim > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.