Skip to content
Prev 58508 / 398502 Next

sub- and superscript in plot labels

On Thu, 4 Nov 2004, Gavin Simpson wrote:
phantom is not part of the R language, just part of the language that 
plotmath understands (like frac and scriptstyle).  The relevant help page 
is ?plotmath.

As to why it works: phantom() returns an empty box large enough to hold 
its argument.  When given no argument, it returns a very small empty box.

In this example the importance of phantom() is that 2-phantom() is parsed 
as a binary operation, indicating that the - character should be typeset 
as a minus sign.   Writing 2- is a parse error, and writing "2-" indicates 
that the - character is ordinary text and should be typeset as a 
hyphen.

 	-thomas