Re: [R] histogram with density

2011-05-24 Thread Steve Lianoglou
On Tue, May 24, 2011 at 12:31 AM, Rekha chithralekh...@gmail.com wrote: S . Am getting error still now if i use both version of the codes . i have to call any library? No. The code you've written here doesn't require loading any other R libraries. Please copy and paste the exact code you've

Re: [R] histogram with density

2011-05-24 Thread Peter Ehlers
On 2011-05-23 21:31, Rekha wrote: S . Am getting error still now if i use both version of the codes . i have to call any library? Your code works fine for me, too, as it should. Have you perhaps redefined the hist() function? Do you get a histogram? The error you quote would result if you

[R] histogram with density

2011-05-23 Thread Rekha
Hello All,* *I want to draw a histogram with density curve. * *For that simply i created a data called*x *and i used the function called *hist(x, col = blue, freq = FALSE),** *from this function i got a histogram*. *After that , i tried this function* ** lines(density(x), col = red, lwd

Re: [R] histogram with density

2011-05-23 Thread Steve Lianoglou
Hi, On Mon, May 23, 2011 at 11:41 PM, Rekha chithralekh...@gmail.com wrote: Hello All,* *I want to draw a histogram with density curve. * *For that simply i created a data called*x *and i used the function called *    hist(x, col = blue, freq = FALSE),**   *from this function i got a

Re: [R] histogram with density

2011-05-23 Thread Rekha
S . Am getting error still now if i use both version of the codes . i have to call any library? On Tue, May 24, 2011 at 9:22 AM, Steve Lianoglou mailinglist.honey...@gmail.com wrote: Hi, On Mon, May 23, 2011 at 11:41 PM, Rekha chithralekh...@gmail.com wrote: Hello All,* *I want to

[R] Histogram and Density on the the same graph

2009-11-30 Thread Trafim
Dear all, I cannot find a function which would allow drawing hist and density on the same graph. x - seq(1,40,1) y - 2*x+1+5*rnorm(length(x)) hist(y,freq = FALSE) plot(density(y)) thanks a lot for the help [[alternative HTML version deleted]]

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Ted Harding
On 30-Nov-09 11:09:12, Trafim wrote: Dear all, I cannot find a function which would allow drawing hist and density on the same graph. x - seq(1,40,1) y - 2*x+1+5*rnorm(length(x)) hist(y,freq = FALSE) plot(density(y)) thanks a lot for the help plot() initiates a completely new plot,

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Trafim
Thanks a lot Ted! I use R help but also cannot find how to expand the graph, i.e. sometimes the top of it is cut for some reason. Maybe there are some limits imposed on y axes, but cannot find it. On Mon, Nov 30, 2009 at 12:27 PM, Ted Harding ted.hard...@manchester.ac.ukwrote: On 30-Nov-09

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Hrishi Mittal
Trafim, If you are plotting more than one variables on the same plot e.g. by using the lines() or points() function, then the limits of the X and Y axes are set based on the first variable you plot. So, you would have to set the xlim and ylim to the limits of the variable with the widest range,

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Rainer M Krug
Chek the topic Second y-axis --- alternative to par(new= which was discussed recently - in that one, there are a few examples, how that can be achieved. Essentially, you have to make sure, that the xlims of the hist() and plot(density()) are the same, and you have to use the par(new=TRUE) (or

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Trafim
I plot only hist(y,freq = FALSE) lines(density(y)) and the graph of density goes higher then hist, but i didn't find any lim parameter for y axes for lines command. Thanks a lot On Mon, Nov 30, 2009 at 1:51 PM, Hrishi Mittal hrishimit...@gmail.comwrote: Trafim, If you are plotting more

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Ted Harding
Trafim, If you are plotting more than one variables on the same plot e.g. by using the lines() or points() function, then the limits of the X and Y axes are set based on the first variable you plot. So, you would have to set the xlim and ylim to the limits of the variable with the widest

[R] Histogram and Density on the the same graph

2009-11-30 Thread Trafim
Dear all, I cannot find a function which would allow drawing hist and density on the same graph. x - seq(1,40,1) y - 2*x+1+5*rnorm(length(x)) hist(y,freq = FALSE) plot(density(y)) thanks a lot for the help [[alternative HTML version deleted]]

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread ONKELINX, Thierry
-project.org] Namens Trafim Verzonden: maandag 30 november 2009 12:01 Aan: r-help@r-project.org Onderwerp: [R] Histogram and Density on the the same graph Dear all, I cannot find a function which would allow drawing hist and density on the same graph. x - seq(1,40,1) y - 2*x+1+5*rnorm(length(x)) hist(y

Re: [R] Histogram and Density on the the same graph

2009-11-30 Thread Jakson A. Aquino
On Mon, Nov 30, 2009 at 12:01:12PM +0100, Trafim wrote: Dear all, I cannot find a function which would allow drawing hist and density on the same graph. x - seq(1,40,1) y - 2*x+1+5*rnorm(length(x)) hist(y,freq = FALSE) plot(density(y)) The package descr has the function histkdnc()