我发现这一点, 如何把标签上geom_bar R中与GGPLOT2 ,但它只是把标签(编号)在只有一个酒吧。
这里,让我们说,两间酒吧每个x轴,如何做同样的事情?
我的数据和代码如下所示:
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))
然后,我们会得到:
看来,一些案文也被定位在“躲闪”的格局。 我搜索geom_text手动找到一些信息,但不能使它工作。
建议?