[R] How to put multiple plots in the same window? (not par(mfrow=))

F Duan f.duan at yale.edu
Fri Jul 30 18:45:49 CEST 2004


Thank all of you. That's exactly what I want.

Best,

Frank


Quoting Gavin Simpson <gavin.simpson at ucl.ac.uk>:

> F Duan wrote:
> > Dear All,
> > 
> > I am sorry if this question has been asked before. Below is my Question:
> > 
> > I want to put several plots in the same window, but I don’t want the blank
> 
> > space between plots (like par(mfrow=)) --- that makes the plots too small.
> 
> > Could anyone tell me how to do it?
> > 
> > Thanks a lot.
> > 
> > Frank
> 
> ?split.screen
> ?layout
> 
> are alternatives to par(mfrow = c()), but I think you need to look at 
> the margins of the plots and reduce them to suit your purposes. See ?par 
> and argument mar. For example:
> 
> oldpar <- par(mfrow = c(2,2), mar = c(3,3,1,1) + 0.1)
> plot(1:10)
> plot(1:10)
> plot(1:10)
> plot(1:10)
> par(oldpar)
> 
> # or
> 
> layout(matrix(c(1,2,3,4), 2, 2, byrow = TRUE))
> layout.show(4)
> oldpar <- par(mar=c(3,3,1,1) + 0.1)
> plot(1:10)
> plot(1:10)
> plot(1:10)
> plot(1:10)
> par(oldpar)
> 
> There is no room for labels/titles but adjust the mar to suit your 
> requirements.
> 
> Gav
> -- 
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> Gavin Simpson                     [T] +44 (0)20 7679 5522
> ENSIS Research Fellow             [F] +44 (0)20 7679 7565
> ENSIS Ltd. & ECRC                 [E] gavin.simpson at ucl.ac.uk
> UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
> 26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
> London.  WC1H 0AP.
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> 
>




More information about the R-help mailing list