[R] win.metafile and multiple plots

Paul Murrell p.murrell at auckland.ac.nz
Thu Mar 14 02:11:04 CET 2002


> I'm having difficulty using the win.metafile command.  I'd like to place
> three plots in one window and then save the window as a metafile.  The
> commands I want to use are:
> win.metafile("mike.emf",width=3,height=2,pointsize=10)
> nf <- layout(matrix(c(1,2,3), 3, 1), heights=c(1,1,1))
> layout.show(nf)
> plot(rnorm(10))
> plot(rnorm(10))
> plot(rnorm(10))
> dev.off()
> However, I get the error:
> Error in plot.new() : A metafile can store only one figure.
> after the first plot.  Any suggestions?

I think you are getting that error because of the layout.show() command.
This produces a diagram of the current layout and then the first
plot(rnorm(10)) starts a new page (which is illegal for a metafile).

Unfortunately, just removing the layout.show() call does not fix everything
because you will then get an error that the "Figure margins too large".
This means that you need to either make the metafile physically larger
(e.g., width=6, height=4 works) or adjust the margins, font size, or
whatever to make enough room for the plots you are producing.

Hope that helps


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list