[R] add lines() to 1st plot in layout() after calling 2nd plot()?

Marianne Promberger marianne.promberger at kcl.ac.uk
Sun Oct 4 12:11:48 CEST 2009


baptiste auguie 04-Oct-09 10:32:
> dev.new()
> layout(matrix(1:4,2, by=T))
> 
> plot(1:10,main="top left plot")
> plot(1:10,main="top right plot")
> plot(1:10,main="bottom left plot")
> plot(1:10,main="bottom right plot")
>
> [...]
>
> par(mfg=c(1,1))
> lines(c(3:7,7:3),col="red")

Brilliant! Thanks!

baptiste auguie 04-Oct-09 10:50:
> After some checking, I think the documentation is at best misleading
> on this particular query. Nowhere could I find mention that par(mfg)
> can work with layout. Instead, I found a warning that suggests
> incompatibility (since mpg is explicitly tied to mfrow in ?par and
> layout is said incompatible with par(mfrow)).

Indeed. I did look around ?par, but due to this warning thought
anything relating to mfrow() and mfcol() would not work anyway.

Thanks again,

Marianne


-- 
Marianne Promberger PhD, King's College London
http://promberger.info
R version 2.9.2 (2009-08-24)
Ubuntu 9.04




More information about the R-help mailing list