[R] Help with histogram intervals

Joshua Wiley jwiley.psych at gmail.com
Tue Jun 28 02:36:04 CEST 2011


Hi Ivo,

It depends how you are making the histogram plot.  If you are using
the traditional graphics hist() function, then look at the argument,
"breaks" (type ?hist at the console to pull up the documentation
explaining this).  For example:

hist(x = sample(1:20, 300, TRUE), breaks = seq(0, 20, by = 2))

HTH,

Josh

On Mon, Jun 27, 2011 at 4:23 PM,  <Gwanmesia at aol.com> wrote:
> Dear Sir,
>
> How do I change the intervals on the x axis of a histogram plot; let us say
>  for example the intervals were 0,5,10,15,and 20, and I wanted to change
> the  intervals to 0,2,4,6,8,10,12,14,16,18,20.
>
> I look forward to receiving your words of wisdom.
>
> Ivo
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list