[R] confused about x-coordinates and bar charts
Jay Pfaffman
pfaffman at relaxpc.com
Fri Jul 18 20:41:52 CEST 2003
Thanks for all the help on my previous histogram problem. I intend to
summarize the solutions back to the list Real Soon Now, but first, I've
got another problem.
I've made a bar chart that reports means. I'd like to put the number
of observations on top of each bar. Here's what I've got:
barplot((subset$x),
col=grey(.5),
ylab="Mean Engagement Rating",
xlab="Comment Category",
main="All Engagement Ratings",
ylim=c(0,7),
cex.names=.75,
names.arg=mynames
)
for (i in 1:7){
text(i,as.numeric(subset$x[i])+.5,counts$x[i])
}
This would seem to do the trick, but the numbers are not centered over
the bars. They're a bit to the right on the bars on the left and
almost right on the bars on the right. I don't understand why the
scale is not the same.
Thanks again for your help.
--
Jay Pfaffman pfaffman at relaxpc.com
+1-415-821-7507 (H) +1-415-812-5047 (M)
More information about the R-help
mailing list