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 hi

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

2009-11-30 Thread ONKELINX, Thierry
.org [mailto:r-help-boun...@r-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,4

[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
> 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 wides

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 wrote: > > Trafim, > > If you are plotting more than one variables o

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 FA

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, o

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 wrote: > On 30-Nov-09 11:09:12, Trafim wrote: > > Dear

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 completel

[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]]