Annotating axis in ggplot2

Posted by mpiktas on Stack Overflow See other posts from Stack Overflow or by mpiktas
Published on 2010-03-25T13:42:48Z Indexed on 2010/03/25 14:03 UTC
Read the original article Hit count: 720

Filed under:
|

I am looking for the way to annotate axis in ggplot2. The example of the problem can be found here: http://learnr.wordpress.com/2009/09/24/ggplot2-back-to-back-bar-charts.

The y axis of the chart (example graph in the link) has an annotation: (million euro). Is there a way to create such types of annotations in ggplot2? Looking at the documentation there is no obvious way, since the ggplot does not explicitly let you put objects outside plotting area. But maybe there is some workaround?

One of the possible workarounds I thought about is using scales:

data=data.frame(x=1:10,y=1:10)
qplot(x=x,y=y,data=data)+scale_y_continuous(breaks=10.1,label="Millions")

But then how do I remove the tick? And it seems that since ggplot does not support multiple scales, I will need to grab the output of the scale_y_continuous, when it calculates the scales automaticaly and then add my custom break and label by hand. Maybe there is a better way?

© Stack Overflow or respective owner

Related posts about ggplot2

Related posts about r