Sébastien Vigneau
2011-Aug-25 15:23 UTC
[R] Combining a greek letter and a newline on the same label
Hi, I would like to add a two-lines label consisting of: "Delta word1\n word2" (with Delta being the actual greek letter). However, when I try "expression(paste(Delta,"word1\nword2"))", I obtain the following display: "word1\n Delta word2". Do you have any idea on how to obtain the desired display? Thank you for your help! Sebastien [[alternative HTML version deleted]]
David Winsemius
2011-Aug-25 15:59 UTC
[R] Combining a greek letter and a newline on the same label
On Aug 25, 2011, at 11:23 AM, S?bastien Vigneau wrote:> Hi, > > I would like to add a two-lines label consisting of: > "Delta word1\n > word2" > (with Delta being the actual greek letter).But you are not saying how word1 and word2 are supposed to be positioned relative to each other and to Delta.> > However, when I try "expression(paste(Delta,"word1\nword2"))", I > obtain the > following display: > "word1\n > Delta word2". > > Do you have any idea on how to obtain the desired display?\n does not get interpreted in plotmath expressions [as the help(plotmath) page states explicitly], but as your example shows [to my complete surprise] if you have then inside text they will get interpreted . Take a look at atop() and over(). Perhaps: plot(1,1,main=expression(over(Delta~word1, word2))) If you don't mean the ratio of change in word1 per word2, then this also gives another possible answer to your vague question. expression(atop(Delta~word1, word2)) and yet a third: plot(1,1,main=expression(Delta~over(word1, word2))) By the way the paste is entirely unneeded there. Using * and ~ as connectors helps keep these expression more readable. Comma then separate arguments for "important" plotmath functions. -- David Winsemius, MD West Hartford, CT