[R] complex subscript/superscript on axis labels

David Winsemius dwinsemius at comcast.net
Thu Feb 9 19:27:03 CET 2012


On Feb 9, 2012, at 1:20 PM, David Winsemius wrote:

>
> 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.
>
And it might look more "physics"-al if you had a "cdot" between the  
units:

[~erg %.% s^-1]

> -- 
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list