[R] Smooth line in graph
Greg Snow
Greg.Snow at intermountainmail.org
Wed Sep 19 23:12:12 CEST 2007
Try:
> lines(spline(x,y, method='n', n=250))
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.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 Nestor Fernandez
> Sent: Wednesday, September 19, 2007 2:09 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Smooth line in graph
>
> 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.
>
> ______________________________________________
> 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