[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
unreadable...
see this
vals <-
c(1,1.1236886,4.77554676,5.3345245,1,1.1236886,4.77554676,5.3345245,5.5345245,5.4345245,1.1236886,4.77554676,5.3345245,1.1236886,4.77554676,5.3345245)
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
options(digits=2)
, and it does change the display of a table, but it does not influence the
barplot...
--
Donatas Glodenis
http://dg.lapas.info
More information about the R-help
mailing list