I've found this, How to put labels over geom_bar in R with ggplot2, but it just put labels(numbers) over only one bar.
Here is, let's say, two bars for each x-axis, how to do the same thing?
My data and code look like this:
dat <- read.table(text = "sample Types Number sample1 A 3641 sample2 A 3119 sample1 B 15815 sample2 B 12334 sample1 C 2706 sample2 C 3147", header=TRUE) library(ggplot2) bar <- ggplot(data=dat, aes(x=Types, y=Number, fill=sample)) + geom_bar(position = 'dodge') + geom_text(aes(label=Number))
then, we'll get:
As a new user, I cannot paste the plot here, thus, please see this http://t1.qpic.cn/mblogpic/1518764902d2367c6104/2000 , great thanks
It seems that the number texts are also positioned in the "dodge" pattern. I've searched http://had.co.nz/ggplot2/geom_text.html to find some information, but no one make it work.