[R] variable values in plotmath expressions

Wolfram Fischer wolfram at fischer-zim.ch
Fri Sep 3 09:13:51 CEST 2004


I tried:

    t <- "sample text"
    x <- 333

    plot( 1, 1
        , main=expression( main[x1] )
        , xlab=expression( paste( t, xlab[x2] ) )
        , sub=parse( text = paste( "sub[", x, "]" ) )
        )

The displayed labels for ``main'' and ``sub'' are as expected.
But ``xlab'' shows only "t" not "sample text".
How can I insert the string on which ``t'' points?

I tried e.g.:
    , ylab=parse( text = paste( t, "ylab[", x, "]" ) )
but I received an error (as suspected).

Wolfram




More information about the R-help mailing list