Whalojazz wrote:
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!

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