Re: [R] values of bars in barplot

From: joerg van den hoff <j.van_den_hoff_at_fz-rossendorf.de>
Date: Mon 30 May 2005 - 23:32:47 EST

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().
>
> Is there a trick I could use to do that ?
>
> Thanks to all
>
> Luc
>
> ______________________________________________
> 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
>

something like:

x <- 1:3
#ensure some free space above the bar and remember midpoints: bmp <- barplot(x, ylim = c(0, 1.1*max(x)))

text(bmp, x + .03*max(x), x)

should do.



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 Received on Mon May 30 23:42:43 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:16 EST