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

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 18 Jan 2007 - 09:56:40 GMT

Try this where you probably only want one of the last two lines:

# population of 5 US states
pop <- state.x77[1:5,1]
bp <- barplot(pop, ylim = range(pop) * c(0, 1.1)) text(bp, pop, pop, adj = c(0.5, -0.5)) # place num above bar mtext(1, at = bp, text = pop, line = 3) # place num below label

On 1/17/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:11:07 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.