Skip to content
Back to formatted view

Raw Message

Message-ID: <43EE3564.4010401@free.fr>
Date: 2006-02-11T19:05:08Z
From: Romain Francois
Subject: plots
In-Reply-To: <43EE3420.8080501@stats.uwo.ca>

Le 11.02.2006 19:59, Duncan Murdoch a ??crit :
> Romain Francois wrote:
>> Le 11.02.2006 19:44, statistical.model at 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
You are right Duncan,

I wish there was a coffea() function in R

;-)


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---------------------------------------------------------------+
| Romain FRANCOIS - http://francoisromain.free.fr               |
| Doctorant INRIA Futurs / EDF                                  |
+---------------------------------------------------------------+