[R] how to make a histogram with percentage on top of each bar?

Jim Lemon jim at bitwrit.com.au
Fri Jun 22 13:03:04 CEST 2012


On 06/22/2012 03:26 AM, york8866 wrote:
> I have a dataset like the following:
> ID	DV
> 1	0.868576818
> 2	0.337120116
> 3	0.029233775
> 4	0.719783525
> 5	0.976631182
> 6	0.672941605
> 7	0.13239462
> 8	0.99936475
> 9	0.91540604
> 10	0.545686514
>
> to get a histogram with y axis as percentage, I wrote the following code"
> library(lattice)
> histogram(data)
>
> now , how to input the percentage and cumulative percentage on top of each
> bar?
>
Hi york8866,
There is a new function in the plotrix package, "barlabels" that will 
probably do what you want. Look for version 3.4-2, which should be 
available in a few days.

Jim



More information about the R-help mailing list