[R] values of bars in barplot

Petr Pikal petr.pikal at precheza.cz
Mon May 30 15:37:00 CEST 2005



On 30 May 2005 at 15:19, luc tardieu wrote:

> Hi, 
> 
> I couldn't find how to have the values written on the
> top of each bar in a barplot. When using hist(), it is
> possible to use labels=T, but this option does not
> seem to exist for barplot().

Hallo

>From help page

Value:

     A numeric vector (or matrix, when 'beside = TRUE'), say 'mp',
     giving the coordinates of _all_ the bar midpoints drawn, useful
     for adding to the graph.


e.g.

> dat<-trunc(runif(5)*10)
> dat
[1] 5 7 1 9 5
> bpl<-barplot(dat, ylim=c(0,10))
> text(bpl,dat+.2, dat)

HTH
Petr


> 
> Is there a trick I could use to do that ?
> 
> Thanks to all
> 
> Luc
> 
> ______________________________________________
> R-help at 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

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list