Hi: 1. expression() in plotmath ignores control characters such as \n. 2. The workaround, discussed a couple of times on this list (hence in the archives), is to use the atop function, so try something like
plot(0:1,0:1,xaxt="n") axis(side=1,at=.3,expression(paste("IFN-", gamma, "\n", "TNF-", alpha))) axis(side=1,at=.6,expression(atop("a label", "2nd line"))) It appears you'll have to make some vertical adjustments, but that's the basic workaround. HTH, Dennis On Tue, Mar 1, 2011 at 11:32 AM, Daryl Morris <dar...@uw.edu> wrote: > 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 > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.