Li, Hua
2009-Jan-21 05:29 UTC
[R] A question on histogram (hist): coordinates on x-axis are too sparse
Dear R helpers: Let's say I have some data X, X <- runif(1000, 1, 10000000000) pdf('X.pdf', width=100,height=5) hist(X, breaks=1000) dev.off() I find that, on x-axis the coordinates are 0e+00, 2e+09, 4e+09, 6e+09, 8e+09, 1e+10. Only five numbers, which is too sparse in a 100x5 pdf file. I want the x-axis coordinates to become more dense, e.g. 0e+00, 1e+09, 2e+09, 3e+09,..... 8e+09, 9e+09, 1e+10. What argument (or function) should I revise to let this happen?? Thanks a lot!! Best, Hua *************************************************************************************** HUA LI Graduate student Biomathematics & Biostatistics The University of Texas Health Science Center At Houston
Duncan Murdoch
2009-Jan-21 12:26 UTC
[R] A question on histogram (hist): coordinates on x-axis are too sparse
Li, Hua wrote:> Dear R helpers: > Let's say I have some data X, > X <- runif(1000, 1, 10000000000) > pdf('X.pdf', width=100,height=5) > hist(X, breaks=1000) > dev.off() > I find that, on x-axis the coordinates are 0e+00, 2e+09, 4e+09, 6e+09, 8e+09, 1e+10. Only five numbers, which is too sparse in a 100x5 pdf file. I want the x-axis coordinates to become more dense, e.g. 0e+00, 1e+09, 2e+09, 3e+09,..... 8e+09, 9e+09, 1e+10. What argument (or function) should I revise to let this happen?? > Thanks a lot!! > Best, HuaYou can draw the axes yourself: hist(X, axes=F) axis(1, at=pretty(X, n=100)) axis(2) box() Duncan Murdoch