[R] Histogram not plotting correct breaks

0 views
Skip to first unread message

burgundy

unread,
Apr 26, 2010, 10:04:15 PM4/26/10
to r-h...@r-project.org

Hi,

I'm using the hist function to plot the frequency of 21 variables, but it
keeps starting the x-axis from 0 and adding variables 1 and 2 together (all
other vairables have the correct frequencies). I suspect it adds 1 and 2
together so that 0 can fit in with demarcations at intervals of 5. Using
"xlim=c(1,21)" to specify that i don't want to include 0 and using the
"breaks" command to specify 21 breaks doesn't help. Any advice?
Thank you!!
--
View this message in context: http://r.789695.n4.nabble.com/Histogram-not-plotting-correct-breaks-tp2066057p2066057.html
Sent from the R help mailing list archive at Nabble.com.

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

--
You received this message because you are subscribed to the Google Groups "R-help-archive" group.
To post to this group, send email to r-help-...@googlegroups.com.
To unsubscribe from this group, send email to r-help-archiv...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/r-help-archive?hl=en.

Tal Galili

unread,
Apr 27, 2010, 1:26:57 AM4/27/10
to burgundy, r-h...@r-project.org
trying setting
br = 40
inside the hist, and check if that helps...
(breaks won't do it for you either way)

Tal

----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.G...@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Tue, Apr 27, 2010 at 5:04 AM, burgundy <sau...@yahoo.com> wrote:

>
> Hi,
>
> I'm using the hist function to plot the frequency of 21 variables, but it
> keeps starting the x-axis from 0 and adding variables 1 and 2 together (all
> other vairables have the correct frequencies). I suspect it adds 1 and 2
> together so that 0 can fit in with demarcations at intervals of 5. Using
> "xlim=c(1,21)" to specify that i don't want to include 0 and using the
> "breaks" command to specify 21 breaks doesn't help. Any advice?
> Thank you!!
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Histogram-not-plotting-correct-breaks-tp2066057p2066057.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-h...@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.
>

[[alternative HTML version deleted]]

Uwe Ligges

unread,
Apr 27, 2010, 5:10:00 AM4/27/10
to Tal Galili, r-h...@r-project.org, burgundy


On 27.04.2010 07:26, Tal Galili wrote:
> trying setting
> br = 40
> inside the hist, and check if that helps...
> (breaks won't do it for you either way)
>
> Tal


No, the main problem is that a hist()ogram is used rather than a
barplot() which should be used....

Uwe Ligges

Greg Snow

unread,
Apr 27, 2010, 1:39:19 PM4/27/10
to burgundy, r-h...@r-project.org
What do you expect to happen to values that fall exactly on the boundary? I have seen questions similar to yours that come about because the user expects different from what the computer does. Look at the 'right' argument to the hist function for a way to change this and see if that helps.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg...@imail.org
801.408.8111
Reply all
Reply to author
Forward
0 new messages