Wondering if geom_text
works for hist
? Tried following code and it seems no effect. I just want to show label (the number of elements belonging to a specific histogram bucket), when plotting each bar for each histogram bucket. Any solutions are appreciated. Thanks.
p <- hist(df$foo,
main="title",xlab="foo")
p + geom_text()
Edit 1, tried geom_bar
, here is my code and it seems not working well, since I expect a number labelled on each bar. In the diagram, it only shows 2.5, 5, 7.5 and 10, I expect to show 1, 2, 3, ..., 9, 10 for each bar.
g <- ggplot(df, aes(df$foo))
g + geom_bar()
regards, Lin
Since no one has answered this I'll give it a try:
First, a few tips:
Now to actually answer your question:
To your question about
..count..
see: Special variables in ggplot (..count.., ..density.., etc.).