[R] complex subscript/superscript on axis labels

David Winsemius dwinsemius at comcast.net
Thu Feb 9 19:20:21 CET 2012


On Feb 9, 2012, at 12:53 PM, Eileen Meyer wrote:

> Hi All,
>
> I am having trouble getting  a complex subscript to work.  I'm sure  
> it's possible.  Here is what I have:
>
>
> ylab=expression(paste("log ",L[peak]," [erg ",s^{-1},"]")),
>
> I would like to have the subscript read "peak,gamma" where the gamma  
> would be the greek symbol.  I do want the comma to show as well.

(I do not see a gamma so using your verbal dsecription. The rest of  
your intent is muddied by the multiple subscripts. It's always  
difficult to know what people are thinking when they construct  
plotmath expressions and do not describe their full intent in English.  
Here's my guess:

ylab=expression(log~L[peak*","*gamma][~erg~s^-1])
  plot(1,1,ylab=ylab)

The paste function is rarely needed and generally confuses the intent  
of the author. Using "~" and "*" generally results in more  
comprehensible expressions.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list