R : Histogram adjust frequency scale representation -


this may trivial, since don't have experience in r, may missing something. basically, frequency values being large being represented in exponents on y axisenter image description here-

here counts

# $counts #  [1] 374850  81009  56419  45259  35765  29697  25637  23587  21461  19418  18221  17094  15902  15098  13874  13257 # [17]  12602  11883  10974  10427   9553   9213   8278   7975   7325   6904   6641   5989   5467   4684   4253   3704 # [33]   3355   2918   2722   2427   2301   2178   1909   1786   1657   1462   1346   1178   1061    900    745    651 # [49]    437    316    214     63 

i understand, rather wide range. there way can compress scale , still have values make sense e.g in k(thousands) or m(millions)?

you can first disabling axis in hist call, adding in axis again of axticks.

# generate data x <- rchisq(1000000,df=1)  # create histogram x.hist <- hist(x,breaks=7,axes=false)  # create new axis  # draw axis along 'y' axticks(2) gets values along 'x' plot axis(2, at=axticks(2), labels=paste(axticks(2)/1000000,"mil",sep=""))  # draw axis along 'x' axticks(1) gets values along 'x' plot axis(1, at=axticks(1), labels=paste( axticks(1) ," hats",sep="")) 

and looks this,

enter image description here


Comments