[R] histogram labels

hadley wickham h.wickham at gmail.com
Fri Oct 19 03:40:04 CEST 2007


Hi Paul,

Why do you want to do that?  Maybe you could publish table along side
your graph if you want people to be able to read the raw numbers.

Hadley

On 10/16/07, H. Paul Benton <hpbenton at scripps.edu> wrote:
> Dear all,
>
> Just a quick one, hopefully. I have a histogram made from the method
> 'hist()'. How do I get labels on the bars? Such that the bars will have
> the x axis on the bar, not the frequency of the point but the number of
> the point itself. To make a quick summary, I want the the numbers from
> 'losses' (below) to be on the bar's.
>
>     Thanks,
>
>     Paul
>
>
> hist<-hist(losses, breaks=length(losses)/2, col="red", main="Frequency
> of the first neutral losses > 5", labels=T, xlim=range(0:150))
>  > length(losses)
> [1] 3096
>  > losses[1:50]
>  [1]  7.835622  7.058985  5.932695  6.018867  9.973944  5.953848  9.004838
>  [8]  9.846519  8.984468  8.898072  7.998546  6.123770  8.811126 13.859201
> [15]  8.970615  5.102851  6.982555  7.891584  7.330879 10.981950 17.913884
> [22]  9.996668 14.021043 12.892713 19.975109  5.979874  6.044765  9.986221
> [29] 10.045082 13.981433 11.963917 15.013278 14.950140 16.990841 15.018136
> [36] 12.944700 46.960090 27.995546 76.978781  7.140487  8.704401  6.043193
> [43]  8.030726  9.085684  8.900260 27.018362  8.449553  8.007181  5.954782
> [50]  8.108130
>
> ______________________________________________
> R-help at 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.
>


-- 
http://had.co.nz/



More information about the R-help mailing list