[R] How to add a title to represent four different plot in lm function

Greg Snow Greg.Snow at imail.org
Thu Feb 25 21:43:48 CET 2010


Try something like:

> par(oma=c(0,0,3,0))
<your plotting commands here>
> mtext("your text here", outer=TRUE

Hope this helps,

-- 
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 FMH
> Sent: Thursday, February 25, 2010 9:01 AM
> To: r-help at r-project.org
> Cc: r-sig-gr at stat.math.ethz.ch
> Subject: [R] How to add a title to represent four different plot in lm
> function
> 
> Dear All,
> 
> A linear regression model could be fitted by using lm function and the
> plot function can be used to check the assumptions of the model. The
> example is as followed.
> 
> require(graphics)
> ## Annette Dobson (1990) "An Introduction to Generalized Linear
> Models".
> ## Page 9: Plant Weight Data.
> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> group <- gl(2,10,20, labels=c("Ctl","Trt"))
> weight <- c(ctl, trt)
> anova(lm.D9 <- lm(weight ~ group))
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(lm.D9, las = 1)
> 
> Could someone advice me the way to add a single title either at the
> above or bottom of these 4 plots, entitled "The verification of model
> assumtion via four different plots" ?
> 
> Thanks
> Fir
> 
> 
> 
> 
> ______________________________________________
> 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.



More information about the R-help mailing list