Re: [R] substitute in graphics - Uwe's help desk

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Sun, 11 May 2008 18:51:56 +0200

Gustave Lefou wrote:
> Hello,
>
> I still have my problem. I couldn't make Uwe Ligges's example work. I wonder
> why :-(
>
> The following doesn't work :
>
> param.list=list(mu1=0,mu2=0,s1=3,s2=2,s3=2,s4=4)
>
> plot(1:8,type="n")
> text(8,3,adj=1,labels=substitute("with " * mu ==
> bgroup("(",atop(mu1,mu2),")") * "," * Sigma[x] ==
> bgroup("(",atop(s1~~s3,s2~~s4),")"),param.list))
>
> But this works :
>
> plot(1:8,type="n")
> text(8,3,adj=1,labels=substitute("with " * mu ==
> bgroup("(",atop(mu1,mu2),")") * "," * Sigma[x] * "=" *
> bgroup("(",atop(s1~~s3,s2~~s4),")"),param.list))
>
> So like in my problem the problem seems to be ==.

Same as in my former mail:

x == y == z

is an invalid expression but you must specify a valid one, even for plotting. ;-)

Best,
Uwe Ligges

> Thank you very much
>
>
> 2008/5/10 Gustave Lefou <gustave5000@gmail.com>:
>

>> Thank to both of you.
>>
>> I found an interesting document by Uwe Ligges in Rnews December 2002 (Vol
>> 2/3)
>>
>> The following seems encouraging
>>
>> x=seq(1,180,by=1)
>> beta=10
>> eta=5
>> plot(x,log(x),type="p",xlab="x",ylab="h(x)",main=substitute("Failure rate "
>> * eta==myeta * "," * beta   ,list(myeta=eta,mybeta=beta)) )
>>
>> but then it fails :
>>
>> x=seq(1,180,by=1)
>> beta=10
>> eta=5
>> plot(x,log(x),type="p",xlab="x",ylab="h(x)",main=substitute("Failure rate
>> from W(" * eta==myeta * "," * beta==mybeta , ")"
>> ,list(myeta=eta,mybeta=beta)) )
>>
>> Any idea ?
>>
>> Thank you very much
>>
>> 2008/5/9 Henrique Dallazuanna <wwwhsd_at_gmail.com>:
>>
>>> Try this:
>>>
>>> plot(x, log(x),
>>>      xlab = "x", ylab = "h(x)",
>>>      main = bquote(Failure~rate~from~W(eta == .(eta), beta == .(beta)))
>>>
>>>
>>> On Fri, May 9, 2008 at 11:31 AM, Gustave Lefou <gustave5000_at_gmail.com>
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> I have to do a few graphics of the same function and this function is
>>>> parametrized by two arguments.
>>>>
>>>> What I would like is to be able to change the value of these two
>>>> arguments
>>>> without changing the plot command. So as to copy paste.
>>>>
>>>> I tried the following :
>>>>
>>>> x=1:100
>>>> eta=10
>>>> beta=5
>>>> plot(x,h(x),xlab="x",ylab="h(x)",main=substitute( expression(
>>>> paste("Failure
>>>> rate from",W(eta==myeta,beta==mybeta) ) ) ,list(myeta=eta,mybeta=beta) )
>>>> )
>>>>
>>>> But it doesn't work. It's written "expression ( Failure rate from
>>>> W(eta=10,)
>>>> ..." on the plot with eta as a greek letter.
>>>>
>>>> Thank you very much !
>>>>
>>>>        [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> 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.
>>>>
>>>
>>>
>>> --
>>> Henrique Dallazuanna
>>> Curitiba-Paraná-Brasil
>>> 25° 25' 40" S 49° 16' 22" O
>>
>>

>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> 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 Sun 11 May 2008 - 17:36:33 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 Sun 11 May 2008 - 18:30:38 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