[R] ggplot2: annotating plot with mathematical formulae
Paul Emberson
email at calidasoft.co.uk
Sat May 16 14:48:43 CEST 2009
Hi Stephen,
The problem is that the label on the graph doesn't get rendered with a
superscript. I want the label on the graph to be rendered the same way
as the label you have put on the axis.
I am plotting a piecewise function and I wanted to label each section of it.
Paul
stephen sefick wrote:
> 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.
>>
>>
>
>
>
>
More information about the R-help
mailing list