[R] plotting mathematical notation and values substitution

Rich FitzJohn rich.fitzjohn at gmail.com
Mon Apr 4 13:11:05 CEST 2005


Gidday,

See ?plotmath and demo(plotmath) for lots of information on plotting
with mathematical symbols.

This produces what you seem to be after (paste() being the missing
ingredient):
plot(1:10, main=substitute(paste("Monotonic Multigamma run ( *",
             list(n==len, theta==t1), " * )"),
             list(len=len, t1=t1)))

This does seem to be a lot of work just to get a theta symbol, and
this seems just as informative:
plot(1:10, main=paste("Monotonic Multigamma run ( * n =", len,
             "theta =", t1, " * )"))

Your second example gives a syntax error for me.

Cheers!
Rich

On Apr 5, 2005 6:50 AM, Luca Scrucca <luca at stat.unipg.it> wrote:
> # 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?

--
Rich FitzJohn
rich.fitzjohn <at> gmail.com   |    http://homepages.paradise.net.nz/richa183
                      You are in a maze of twisty little functions, all alike




More information about the R-help mailing list