[R] ggplot2: annotating plot with mathematical formulae
hadley wickham
h.wickham at gmail.com
Sat May 16 18:17:20 CEST 2009
Hi Paul,
Unfortunately that's not something that's currently possible with
ggplot2, but I am thinking about how to make it possible.
Hadley
On Sat, May 16, 2009 at 7:48 AM, Paul Emberson <email at calidasoft.co.uk> wrote:
> 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.
>>>
>>>
>>
>>
>>
>>
>
> ______________________________________________
> 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.
>
--
http://had.co.nz/
More information about the R-help
mailing list