Unless you are intentionally trying to distort your data and make the graph
harder to read (you don't want to do that), it is better to put the numbers in
the margin rather than at the top of the bars. Try the following line after
the barplot:
> mtext( dat$NumberOfPeople, side=1, line=1.5, at=
names(dat)<-c("NumberOfPeople","Average")
Graph<-barplot(dat$Average)
barplot(dat$Average, ylim=c(0,max(dat[,2]+.2)))
text(Graph, dat[,2], dat[,1], pos=3)
The reason for the ylim is so that the number for the righthand bar does not go
outside the plot area.
--- On Mon, 7/27/09, Mohsen Jafariki
The only thing you're missing is the midpoints of the bars. Since you
specified
> Graph <- barplot(dat$Average)
You can get the midpoints from the Graph object. So to put the number
on top of each bar you might use something like:
> text(Graph, dat$Average, dat$Average)
-Original Message
3 matches
Mail list logo