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. What am I doing incorrectly? Rich
David Winsemius
2011-Oct-21 15:45 UTC
[R] Specifying Greek Character in Lattice Plot Label
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