Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Thin bars in R hist !!??
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Whalojazz  
View profile  
 More options Jan 3 2010, 4:25 pm
From: Whalojazz <mbel...@gmail.com>
Date: Sun, 3 Jan 2010 13:25:25 -0800 (PST)
Local: Sun, Jan 3 2010 4:25 pm
Subject: [R] Thin bars in R hist !!??

Hi,

I am trying to plot a histogram with my dataset that has 68 elements, 67 of
which are zero and the last one is 18. It can be reproduced as follows:

x<-array(0, dim=(68))
x[1] = 18
I am trying to plot its histogram using:

hist(x, breaks=10, xlim=c(0, 100), axes=F)
axis(2, at=seq(0, 70, 5))      #  for the y-axis
axis(1, at=seq(0, 100, 10))  # for the x-axis

As you would also see if you reproduced the plot, the bars become really
thin. I would very much appreciate any help on fixing this issue. Thanks so
much in advance!
--
View this message in context: http://n4.nabble.com/Thin-bars-in-R-hist-tp997908p997908.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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jim Lemon  
View profile  
 More options Jan 3 2010, 5:14 pm
From: Jim Lemon <j...@bitwrit.com.au>
Date: Mon, 04 Jan 2010 09:14:06 +1100
Local: Sun, Jan 3 2010 5:14 pm
Subject: Re: [R] Thin bars in R hist !!??
On 01/04/2010 08:25 AM, Whalojazz wrote:

Hi Whalojazz,
There is the possibility of matching the x axis limits to the range of
the data:

hist(x, breaks=10, xlim=c(0, 18), axes=FALSE)
axis(2, at=seq(0, 70, 5))
axis(1, at=seq(0, 18, 9))

but this would not leave you all that tempting, empty space in which you
could insert a cartoon or humorous epigram. Why don't we split the
difference and try:

x11(width=10,height=7)
hist(x, breaks=10, xlim=c(0, 40), axes=FALSE)
axis(2, at=seq(0, 70, 5))
axis(1, at=seq(0, 40, 10))

Jim

______________________________________________
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Ehlers  
View profile  
 More options Jan 3 2010, 5:12 pm
From: Peter Ehlers <ehl...@ucalgary.ca>
Date: Sun, 03 Jan 2010 15:12:07 -0700
Local: Sun, Jan 3 2010 5:12 pm
Subject: Re: [R] Thin bars in R hist !!??
Just seting breaks=2 should fix your 'issue'.
But what could such a histogram possibly tell anyone?
Unless this is a pathological case in a more elaborate
analysis, I can't see any sense in what you're doing.

  -Peter Ehlers

--
Peter Ehlers
University of Calgary
403.202.3921

______________________________________________
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Dalgaard  
View profile  
 More options Jan 3 2010, 5:18 pm
From: Peter Dalgaard <p.dalga...@biostat.ku.dk>
Date: Sun, 03 Jan 2010 23:18:04 +0100
Local: Sun, Jan 3 2010 5:18 pm
Subject: Re: [R] Thin bars in R hist !!??

You are asking for a range of data from 0 to 18 to be divided into about
10 bins, so each bin will have a width of roughly 0.2.

If this is not what you wanted, then you need to do something else,
depending on what you wanted but didn't tell...

Were you perhaps looking for hist(x, breaks=seq(0, 100,10))? (Notice
that if "breaks" is a single number, it will generate breaks based on
range(x), not xlim.)

--
    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalga...@biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Whalojazz  
View profile  
 More options Jan 3 2010, 5:27 pm
From: Whalojazz <mbel...@gmail.com>
Date: Sun, 3 Jan 2010 14:27:56 -0800 (PST)
Local: Sun, Jan 3 2010 5:27 pm
Subject: Re: [R] Thin bars in R hist !!??

Peter Ehlers wrote:

> Just seting breaks=2 should fix your 'issue'.
> But what could such a histogram possibly tell anyone?
> Unless this is a pathological case in a more elaborate
> analysis, I can't see any sense in what you're doing.

Yes it did! However, this requires that I explicitly set break to the number
of nonzero entries in the x's count. I see your point about the histogram
but I believe it's important for me to show zero values as well.

Thanks a lot!
--
View this message in context: http://n4.nabble.com/Thin-bars-in-R-hist-tp997908p997943.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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Whalojazz  
View profile  
 More options Jan 3 2010, 5:28 pm
From: Whalojazz <mbel...@gmail.com>
Date: Sun, 3 Jan 2010 14:28:59 -0800 (PST)
Local: Sun, Jan 3 2010 5:28 pm
Subject: Re: [R] Thin bars in R hist !!??

Peter Dalgaard wrote:

> Were you perhaps looking for hist(x, breaks=seq(0, 100,10))? (Notice
> that if "breaks" is a single number, it will generate breaks based on
> range(x), not xlim.)

Great! That's *exactly* what I needed. Thanks a lot!
--
View this message in context: http://n4.nabble.com/Thin-bars-in-R-hist-tp997908p997945.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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »