Re: [R] label option in 'barplot'?

From: talepanda <talepanda_at_gmail.com>
Date: Thu 18 Jan 2007 - 10:01:52 GMT

Probably, you have to manually create, but it is easy:

# for beside=F
mp <- barplot(VADeaths)
text(mp,y<-t(apply(VADeaths,2,cumsum)),y) # labels are values itself # or
mp <- barplot(VADeaths)
text(mp,t(apply(VADeaths,2,cumsum)),VADeaths) # labels are cumsum of values

# for besides=T
mp <- barplot(VADeaths,beside=T)
text(mp,VADeaths,VADeaths)

## maybe some adjustment is required for y position, then, for example,

mp <- barplot(VADeaths,beside=T)
text(mp,VADeaths+3,VADeaths)

HTH On 1/18/07, Justin Gengler <jgengler@umich.edu> wrote:
> Hello all,
>
> When using the 'barplot' function, how would one go about creating
> labels on the top of the bars corresponding to the actual frequency
> values (i.e., the height of the bar). For histograms, one can use
> the 'LABEL=T' parameter to this effect, but it is not available for
> barplot. Must one manually create such labels for a barplot (perhaps
> using mtext)?
>
> Thanks.
>
> Justin Gengler
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>



R-help@stat.math.ethz.ch 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. Received on Thu Jan 18 21:06:56 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 18 Jan 2007 - 10:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.