[R] Unexpected mfrow, layout behavior (pdf still has multiple pages)
Peter Dalgaard
P.Dalgaard at biostat.ku.dk
Thu Feb 5 13:58:36 CET 2009
Paul Johnston wrote:
> My goal is to create a graph with one column and three rows into a
> single graphic. The mfrow, mfcol, and layout functions all have the
> same effect: three graphs are produced in a single pdf file, having
> one graph per page. This is not what I want (I didn't want multiple
> pages). Just before I sent this post, I was able to generate the
> desired output with split.screen. Is this the expected behavior of
> mfrow and layout?
If you call them before opening the device, then yes, they will not
affect that device, but presumably some other device...
-p
>
> Paul
>
> --------------------------------
>
> My code is as follows (ToruosityPlot and DiameterPlot are essentially
> identical to LDRPlot).
>
> layout(matrix(1:3, ncol=1))
> #par(mfrow=c(3,1))
>
> pdf("results.pdf", width=4, height=3, pointsize=4, colormodel="cmyk",
> onefile=TRUE)
>
> TortuosityPlot(left, right)
> DiameterPlot(left, right)
> LDRPlot(left, right)
>
> dev.off()
>
> LDRPlot <- function(left, right)
> {
> plot(left$x, left$LDR, bty="n", ann=FALSE, xlim=c(-1500, 1000),
> ylim=c(1.0, 1.5))
> abline(v=0, col=gray(.90))
> lines(left$x, left$LDR, col="green4", lty="solid")
> points(left$x, left$LDR, bg="limegreen", pch=21)
> lines(right$x, right$LDR, col="blue4", lty="dashed")
> points(right$x, right$LDR, bg="blue", pch=21)
> #title(main="LDR", xlab="Distance (um)", ylab="LDR",
> col.main="black", col.lab=gray(.4), cex.main=1.2, cex.lab=1.0,
> font.main=4, font.lab=3)
> }
>
>
> platform i386-apple-darwin8.11.1
> arch i386
> os darwin8.11.1
> system i386, darwin8.11.1
> status
> major 2
> minor 8.1
> year 2008
> month 12
> day 22
> svn rev 47281
> language R
> version.string R version 2.8.1 (2008-12-22)
>
> ______________________________________________
> 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.
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list