Re: [R] plots

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Sun 12 Feb 2006 - 05:59:44 EST

Romain Francois wrote:
> Le 11.02.2006 19:44, statistical.model@googlemail.com a écrit :
>
>>Hi all,
>>I have a basic question. how can i visualize two or more density curves on
>>the same plot?
>>
>>ex:
>>x1<-runif(100,10,80)
>>x2<-runif(100,1,100)
>>kernelgraf<-density(x1,kernel = "gaussian", width= 20)
>>plot(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1),
>>col=rgb(0,1,0), main="")
>>kernelgraf<-density(x2,kernel = "gaussian", width= 20)
>>points(kernelgraf, xlab="Probability", xlim=c(0,100), ylim=c(0,.1),
>>col=rgb(0,0,1), main="")
>>
>>here i am using plot + points, but i do not like the graphical output for
>>points.
>>
>
> You are almost there, replace your last command by :
>
> points(kernelgraf, type="l", col="blue")
>
> Romain
>
> PS : Maybe a function points.density setting type="l" would be a good
> thing ?

Or maybe use

lines(kernelgraf, type="l", col="blue")

As I always say, when you want lines, use lines().

Duncan Murdoch
>
>>can anybody help me?
>>
>>thanks in advance
>>
>>Roberto Furlan
>>University of Turin
>>
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Feb 12 06:06:16 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:27 EST