[R] how to include bar values in a barplot?

Donatas G. dgvirtual at akl.lt
Wed Aug 8 09:41:28 CEST 2007

On Wednesday 08 August 2007 00:40:56 Donatas G. wrote:
> On Tuesday 07 August 2007 22:09:52 Donatas G. wrote:
> > How do I include bar values in a barplot (or other R graphics, where this
> > could be applicable)?
> >
> > To make sure I am clear I am attaching a barplot created with
> > OpenOffice.org which has barplot values written on top of each barplot.
> After more than two hours search I finally found a solution:
> http://tolstoy.newcastle.edu.au/R/help/06/05/27286.html

Hey, the solution happens to be only partiall... If the values are not real 
numbers, and have a lot of digits after the dot, the graph might become 

see this

vals <- 
names(vals) <- LETTERS[1:16] 
mp <- barplot(vals, ylim = c(0, 6)) 
text(mp, vals, labels = vals, pos = 3) 

Is there any way to round up those numbers?

I tried using 
, and it does change the display of a table, but it does not influence the 
Donatas Glodenis

More information about the R-help mailing list