[R] ggplot2: annotating plot with mathematical formulae
baptiste auguie
ba208 at exeter.ac.uk
Sat May 16 19:39:17 CEST 2009
If you're desperate for a workaround, you might want to try this
example using pgfSweave,
http://ggplot2.wik.is/Mathematical_annotations
On a similar vein, you could try psfrag replacements with a postscript
device (there is some code for this on the list archives).
Feel free to comment / edit on the wiki page.
HTH,
baptiste
On 16 May 2009, at 14:48, Paul Emberson 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.
_____________________________
Baptiste Auguié
School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK
Phone: +44 1392 264187
http://newton.ex.ac.uk/research/emag
More information about the R-help
mailing list