Re: [R] LaTeX in R

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Fri, 07 Mar 2008 16:29:52 +0100

Mario Maiworm wrote:
> Thank you, uwe and jeremy. I was actually looking exactly for that! But
> something still doesn't work:
> I want to plot a symbol in a legend of a plot, lets say "\sigma = 2". 2
> should be the value of a variable. So, when I try
>
> mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
> legend(x="topright",legend=paste(expression(sigma)," = ",mySigma),lty=1)
>
> , the sigma is not plotted as a symbol. This version:
>
> mySigma=2;plot(1:10,dnorm(1:10,sd=mySigma),type='l')
> legend(x="topright",legend=expression(paste(sigma," = ",mySigma)),lty=1)
>
> gives me a 'real' sigma but the mySigma variable is not evaluated. Any
> ideas?

Yes:

mySigma <- 2
plot(1:10, dnorm(1:10, sd = mySigma), type='l') legend(x = "topright", lty = 1,

        legend = substitute(sigma == myS, list(myS = mySigma)))

Uwe Ligges

> Mario.
>
> __________________________________________________________________
>
> Mario Maiworm
> Biological Psychology and Neuropsychology
> University of Hamburg
> Von-Melle-Park 11
> D-20146 Hamburg
>
> Tel.: +49 40 42838 3515
> Fax.: +49 40 42838 6591
>
> http://bpn.uni-hamburg.de/Maiworm_e.html
> http://cinacs.org
> __________________________________________________________________
>

>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Uwe Ligges [mailto:ligges_at_statistik.tu-dortmund.de]
>>>> Gesendet: Freitag, 7. März 2008 15:27
>>>> An: Mario Maiworm
>>>> Cc: r-help_at_r-project.org
>>>> Betreff: Re: [R] LaTeX in R
>>>>
>>>>
>>>>
>>>> Mario Maiworm wrote:
>>>>> Dear Rers,
>>>>> I understand that I can include R-code in LaTeX using Sweave. Is there
>>>> a way
>>>>> to do it the other way round? Particularly, I need some TeX symbols in
>>>> the
>>>>> legend of an R-plot. This can be done in matlab easily, so I am
>>>> optimistic
>>>>> with R. Any suggestions for a command or package?
>>>> See   ?plotmath
>>>>
>>>> Uwe Ligges
>>>>
>>>>
>>>>
>>>>
>>>>> Best,
>>>>> Mario.
>>>>>
>>>>>
>>>>>
>>>>> __________________________________________________________________
>>>>>
>>>>> Mario Maiworm
>>>>> Biological Psychology and Neuropsychology
>>>>> University of Hamburg
>>>>> Von-Melle-Park 11
>>>>> D-20146 Hamburg
>>>>>
>>>>> Tel.: +49 40 42838 3515
>>>>> Fax.: +49 40 42838 6591
>>>>>
>>>>> http://bpn.uni-hamburg.de/Maiworm_e.html
>>>>> http://cinacs.org
>>>>>
>>>>> ______________________________________________
>>>>> 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. Received on Fri 07 Mar 2008 - 15:33:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 07 Mar 2008 - 16:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive