[R] Change default parameters of panel.smooth
Simon Blomberg
Simon.Blomberg at anu.edu.au
Thu Jun 26 08:25:43 CEST 2003
> -----Original Message-----
> From: Dowkiw, Arnaud [mailto:Arnaud.Dowkiw at dpi.qld.gov.au]
> Sent: Thursday, 26 June 2003 3:52 PM
> To: R help mailing list (E-mail)
> Subject: [R] Change default parameters of panel.smooth
>
>
> Hello,
>
> can anyome tell me how to access the full script of the
> panel.smooth function so that I can change the thickness of
> the smoothing line or its colour ?
> All I could access is :
>
> > panel.smooth
> function (x, y, col = par("col"), bg = NA, pch = par("pch"),
> cex = 1, col.smooth = "red", span = 2/3, iter = 3, ...)
> {
> points(x, y, pch = pch, col = col, bg = bg, cex = cex)
> ok <- is.finite(x) & is.finite(y)
> if (any(ok))
> lines(lowess(x[ok], y[ok], f = span, iter = iter),
> col = col.smooth,
> ...)
> }
> <environment: namespace:base>
I think that is all you need. Colour can be changed by setting col.smooth, and the line thickness is actually controlled by lines(), but if you pass panel.smooth lwd=3 (say), it is passed along to lines() with the rest of the arguments. Try:
> x <- rnorm(10)
> y <- rnorm(10)
> plot(x,y)
> panel.smooth(x,y,col.smooth="blue", lwd=3)
>
HTH,
Simon.
Simon Blomberg, PhD
Depression & Anxiety Consumer Research Unit
Centre for Mental Health Research
Australian National University
http://www.anu.edu.au/cmhr/
Simon.Blomberg at anu.edu.au +61 (2) 6125 3379
More information about the R-help
mailing list