[R] Smooth line in graph

Nestor Fernandez nestor at ual.es
Wed Sep 19 22:09:24 CEST 2007


Hi,

I’m trying to get smooth curves connecting points in a plot using 
"spline" but I don’t get what I whant.

Eg.:
x<-1:5
y <- c(0.31, 0.45, 0.84, 0.43, 0.25)
plot(x,y)
lines(spline(x,y))

Creates a valley between the first and second points, then peaks at 3rd, 
and another valley between 4th and 5th. I’m trying to get a consistently 
growing curve up to the 3rth point and then a decrease like with 
SigmaPlot spline curves or with Excel.

I tried with different spline arguments and also lowess and loess, with 
no success. Any ideas?

Thanks.



More information about the R-help mailing list