[R] Change default parameters of panel.smooth

Dowkiw, Arnaud Arnaud.Dowkiw at dpi.qld.gov.au
Thu Jun 26 08:43:49 CEST 2003


Thanks Simon,

in fact, problems occur when I use panel.smooth inside pairs, not when I use panel.smooth alone :

> pairs(Fingaroy.F3.cross3.Streetonout.df[,c(5:9)],main="Kingaroy -- F3 -- Cross3",lower.panel=panel.smooth,upper.panel=panel.cor,diag.panel=panel.hist)

when I do this, I don't know how to change the parameters of panel.smooth, I tried :

> pairs(Fingaroy.F3.cross4.Streetonout.df[,c(5:9)],main="Kingaroy -- F3 -- Cross4",lower.panel=panel.smoot(col.smooth="blue"),upper.panel=panel.cor,diag.panel=panel.hist)

and got :

Error in points(x, y, pch = pch, col = col, bg = bg, cex = cex) : 
        Argument "x" is missing, with no default
 ...

What should I do ?

Arnaud



-----Original Message-----
From: Simon Blomberg [mailto:Simon.Blomberg at anu.edu.au]
Sent: Thursday, 26 June 2003 4:26 PM
To: Dowkiw, Arnaud; R help mailing list (E-mail)
Subject: RE: [R] Change default parameters of panel.smooth




> -----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
 

********************************DISCLAIMER******************...{{dropped}}




More information about the R-help mailing list