On 05/07/2012 3:34 PM, Sarah Goslee wrote:
Hi Jim,

You can't specify both number of bins and bin size. You can specify
breaks: either the number of bins or the location of breakpoints. A
histogram with 20 bins of 50 observations each must by definition come
from a uniform distribution.

Only if the bins are equal in size. You could set the bins to quantiles, for the following ugly plot:

hist(x, breaks=quantile(x, seq(0, 1, by=0.05)))

Duncan Murdoch


What are you trying to accomplish?

Sarah

On Thu, Jul 5, 2012 at 3:29 PM, Jim Silverton <jim.silver...@gmail.com> wrote:
> I have a column of 1000 datapoints from the normal distribution with mean 2
> and variance 4. How can I get a histogram of these observations with 20
> bins with each bin having 50 observations?
>
> --
> Thanks,
> Jim.



______________________________________________
R-help@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.

Reply via email to