[R] Supperscript, subscript and double lines in the main/subtitle and using greekletters

David Winsemius dwinsemius at comcast.net
Tue Mar 27 17:36:06 CEST 2012

On Mar 27, 2012, at 9:39 AM, Gerrit Eichner wrote:

> Hi, HJ,
> see
> ?plotmath
> Hth  --  Gerrit
> ---------------------------------------------------------------------
> Dr. Gerrit Eichner                   Mathematical Institute, Room 212
> On Tue, 27 Mar 2012, HJ YAN wrote:
>> Dear R-help,
>> I am trying to express myself as best as I can here. If you also  
>> use Latex
>> to edit math reports or other languages with similar editing method,
>> you'll see what I'm talking about. My sincere appologies if my  
>> question is
>> not clear enough to some extend, as also I'm not able to provide my  
>> code
>> here because I don`t know which one I can use...
>> When editing the title in R plots, such as using 'plot', or  
>> 'xyplot' in
>> 'lattic', what method do you use to write greek letters and make  
>> use of
>> superscript and subscript, e.g. to write mathematical expressions  
>> like
>> using Latex:
>> \sigma^2
>> \tau^{2s}
>> \mu_i
>> \pi_{2s}
>> Also I would like to learn how to make two lines in the main title  
>> or sub
>> title if the text I need it too long for putting in a single line,  
>> e.g. are
>> there some R code/syntax allowing me to do something like in Latex  
>> to make
>> two lines in the title, for example using '//' or '\\' to seperate  
>> the two
>> parts of the text I want to put in two lines??
>> I heard about using something like
>> plot(x,y, main=expression(....))
>> but from neither '?plot' or '?expression' could I find comprehensive
>> information about what I need...

The plotmath environment (not the correct term) will not accept the  
usual EOL "\n" marker for new lines. You can cobble together a  
subsitute (at least for the two line problem) using the plotmath  
`atop` function.

plot(1,1, main=expression(atop("  bbbblllllaaahhh"~tau,  

Notice the need for a plotmath connector such as "~" or "*" between  
the text and the unquoted "greeks".


David Winsemius, MD
West Hartford, CT

More information about the R-help mailing list