[R] plotting mathematical notation and values substitution

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Mon Apr 4 16:57:17 CEST 2005



Luca Scrucca wrote on 4/4/2005 1:50 PM:
> Dear R-users,
> 
> I'm trying to add a title on a plot with both mathematical notation and
> values substitution. I read the documentation and search the mailing list
> but I was not able to solve my problem. Actually, there is a message by
> Uwe Ligges on June 2003 which addresses a question very close to mine, but
> the code provided doesn't work. The code is the following:
> 
> # I add this to let you run the example by copy and paste
> 
>>t1 <- 0.5; len <- 1
> 
> # then
> 
>>plot(1:10,
> 
>        main = substitute("Monotonic Multigamma run (" * n == len * ", " *
> theta == t1 * ").", list(len = len, t1 = t1)))
> 
> but I got the following:
> 
> Error: syntax error
> 
> I also tried with just one value substitution:
> 
> 
>>plot(1:10,
> 
>        main = substitute("Monotonic Multigamma run (" theta == t1 * ").",
> list(len = len, t1 = t1)))
> 
> which works fine. How can I have more than one value substitution,
> together with mathematical notation and text?
> 
> Thanks in advance for any reply.
> 
> Luca Scrucca
> 
> 

Luca,

I believe you need paste in this instance:

t1 <- 0.5; len <- 1
plot(1:10, main = substitute(paste("Monotonic Multigamma run (", n == 
len, ", ", theta == t1, ").", sep = ""), list(len = len, t1 = t1)))


--sundar




More information about the R-help mailing list