Show frequencies along with barplot in ggplot2?

Geom_text is tha analog of text from base graphics.

Geom_text is tha analog of text from base graphics: p + geom_bar() + stat_bin(aes(label=..count..), vjust=0, geom="text", position="identity") If you want to adjust the y-position of the labels, you can use the y= aesthetic within stat_bin: for example, y=..count..+1 will put the label one unit above the bar. The above also works if you use geom_text and stat="bin" inside.

Thank you so much for this one! It does exactly the thing I wanted! – aL3xa Mar 31 '10 at 21:08.

A hard way to do it. I'm sure there are better approaches. Ggplot(mtcars,aes(factor(cyl))) + geom_bar() + geom_text(aes(y=sapply(cyl,function(x) 1+table(cyl)names(table(cyl))==x), label=sapply(cyl,function(x) table(cyl)names(table(cyl))==x))).

5 It's generally good practice to create your data outside of your plotting code. And it is never a good idea to shove data into the aesthetic mappings. – hadley Mar 31 '10 at 14:31.

Text from base graphics or?boxed. Labels from the plotrix package.

When wanting to add different info the following works: ggplot(mydata, aes(x=clusterSize, y=occurence)) + geom_bar() + geom_text(aes(x=clusterSize, y=occurence, label = mydata$otherinfo)).

I doubt that barplot can be drawn with y variable specified "as is"... – aL3xa Jun 8 '10 at 1:07.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions