Paul Emberson
2009-May-16 02:02 UTC
[R] ggplot2: annotating plot with mathematical formulae
Hi, Is there a way of annotating a ggplot plot with mathematical formulae? I can do geom_text(aes(label="some text", ... but I can't do geom_text(aes(label=expression(x^{n-1}), ... It gives the error Error: geom_text requires the following missing aesthetics: label Is there a convenient equivalent? Cheers, Paul
stephen sefick
2009-May-16 03:38 UTC
[R] ggplot2: annotating plot with mathematical formulae
how about this a <- 1:10 b <- 1:10 d <- paste("x","^","{n-1}") qplot(a,b, xlab=expression(x^{n-1}))+geom_text(aes(4,8, label=d)) On Fri, May 15, 2009 at 10:02 PM, Paul Emberson <email at calidasoft.co.uk> wrote:> Hi, > > Is there a way of annotating a ggplot plot with mathematical formulae? > > I can do > > geom_text(aes(label="some text", ... > > but I can't do > > geom_text(aes(label=expression(x^{n-1}), ... > > It gives the error > > Error: geom_text requires the following missing aesthetics: label > > Is there a convenient equivalent? > > Cheers, > > Paul > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis