[R] expression help

Daryl Morris darylm at uw.edu
Tue Mar 1 20:32:13 CET 2011


Hello,

I am trying to write math-type on a plot.  Due to space limitations on 
the plot, I want 2 short expressions written on top of each other.  It 
is certainly possible to write them in two separate calls, but that 
involves fine-tuning locations and a lot of trial and error (and I'm 
trying to write a general purpose function).

Here's where I've gotten to:
plot(0:1,0:1,xaxt="n")
axis(side=1,at=.3,expression(paste("IFN-", gamma, "\n", "TNF-", alpha)))
axis(side=1,at=.6,"a label\n2nd line")

What I am trying to do is illustrated by the the non-expression axis 
label ("a label\n2nd line").  The "\n" forces a new line when I'm not 
using expressions, but doesn't work for my real example.

I have googled for general documentation on expressions, but the only 
thing I've been able to find is the help for plotmath(), so if someone 
can point me to more complete documentation that would also be helpful.

thanks, Daryl
SCHARP, FHCRC, UW Biostatistics



More information about the R-help mailing list