Data Analytics Corp. wrote:>
> Hi,
>
> In R base graphics, the function mtext can be used to add text to the
> margins of a plot. This is very useful for adding notes (such as data
> source, sample size, etc.) to the bottom of a graph. How can such notes
> be added to the bottom of a graph when using ggplot2?
>
Can't think of an easy/elegant way.
One quick hack:
> d = data.frame(x=1:10,y=runif(10))
> ggplot(d,aes(x=x,y=y))+geom_point()+labs(x="abc\n\nnote:def")
you might also have some luck with grid.text:
grid.text("abc",x=unit(0.8,"npc"),y=unit(0.1,"npc"))
--
View this message in context:
http://www.nabble.com/ggplot2-and-mtext-question-tp25103495p25104611.html
Sent from the R help mailing list archive at Nabble.com.