[R] drawing curve

baptiste auguie baptiste.auguie at googlemail.com
Thu Jun 10 16:57:50 CEST 2010


The OP asked for a smooth curve,

foo = splinefun(x,y)
curve(foo, min(x), max(x))
# points(x,y)

I'm sure a R wizard could make it a one-liner.

HTH,

baptiste

On 10 June 2010 16:48, Mario Valle <mvalle at cscs.ch> wrote:
> x<-c(1:6)
> y<-c(.01,.09,.08,.03,.001,.02)
> plot(x,y, type='l')
>
> Please try ?plot before asking to the list.
> Ciao!
>                mario
>
> On 10-Jun-10 12:11, suman dhara wrote:
>>
>> Sir,
>> I have a problem regarding drawing curve.I pose the problem as follows:
>>
>> suppose I have two vectors:
>> x<-c(1:6)
>> y<-c(.01,.09,.08,.03,.001,.02)
>> plot(x,y)
>>
>> It gives me the plotted points.But I want to draw a smooth curve passing
>> througt these points.
>> How can I do this?
>>
>>
>> Thanks&  Regards,
>> Suman Dhara
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>
> --
> Ing. Mario Valle
> Data Analysis and Visualization Group            |
> http://www.cscs.ch/~mvalle
> Swiss National Supercomputing Centre (CSCS)      | Tel:  +41 (91) 610.82.60
> v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82
>
> ______________________________________________
> 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.
>



-- 
____________________

Baptiste Auguié

Departamento de Química Física,
Universidade de Vigo,
Campus Universitario, 36310, Vigo, Spain

tel: +34 9868 18617
http://webs.uvigo.es/coloides



More information about the R-help mailing list