[R] Specifying Greek Character in Lattice Plot Label

Luke Miller millerlp at gmail.com
Fri Oct 21 18:26:18 CEST 2011


The following produces something very similar to David's method:

plot(1,1, xlab = expression(paste("Conductivity (", mu, "S / cm)")))

but with a slightly different slash character. I think David's method
is more "correct", but I've used the above method in the past with
some success.

On Fri, Oct 21, 2011 at 11:45 AM, David Winsemius
<dwinsemius at comcast.net> wrote:
>
> On Oct 21, 2011, at 11:27 AM, Rich Shepard wrote:
>
>>  For an axis label I want to include the Greek letter mu within the string.
>> I've not found the proper way of including that expression within the
>> string.
>>
>>  What I want is "Conductivity (uS/cm)" with the 'u' replaced by mu. When I
>> try "Conductivity (" expression(paste(mu)) "S/cm)" I get an error. If I
>> don't separate Conductivity and S/cm with parentheses the string
>> 'expression(paste(mu))' displays in the lable.
>
> try:
>
>  plot(1,1, xlab=expression(Conductivity~"("*mu*S/cm*")") )
>
> Parens are the only characters that need to be quoted and you do need to use proper plotmath connectors,  "~" and "*" depending on whether you ant a space to appear or not. I don't hink you can join character values and expression values in the manner that you offer but I admit I never tried it, so I don't know for sure. Generally "language" and "expression" objects have their own special set of functions and syntax.
>
>>
>>  What am I doing incorrectly?
>>
>> Rich
>>
>> ______________________________________________
>> 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
>
> ______________________________________________
> 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.



--
___________________________
Luke Miller
Postdoctoral Researcher
Marine Science Center
Northeastern University
Nahant, MA
(781) 581-7370 x318



More information about the R-help mailing list