[R] how to smooth a line in a graph

Martina Pavlicova pavlicov at stat.ohio-state.edu
Thu May 29 19:55:48 CEST 2003


> x <- c(1,2,3,4,5)
> y <- c(5,2,1,.5,.2)

> plot(x,y)
> lines(spline(x,y, 100))

See ?spline

Hope that helps.

Martina Pavlicova
--------------------------------------------------------------------------
Department of Statistics             Office Phone: (614) 292-1567
1958 Neil Avenue, 304E Cockins Hall  FAX: (614) 292-2096
The Ohio State University            E-mail: pavlicov at stat.ohio-state.edu
Columbus, OH 43210-1247              www.stat.ohio-state.edu/~pavlicov


On 29 May 2003, Rado Bonk wrote:

> Hi R-users,
>
> I have a line graph made by plot(). The line is very similar to
> hyperbola, and consists of 5 points. How can I make it look smooth?
>
> Thanks,
>
> Rado
>
> --
> Radoslav Bonk M.S.
> Dept. of Physical Geography and Geoecology
> Faculty of Sciences, Comenius University
> Mlynska Dolina 842 15, Bratislava, SLOVAKIA
> tel: +421 905 968 127 e-mail: rbonk at host.sk
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list