HJ YAN
2012-Mar-27 13:00 UTC
[R] Supperscript, subscript and double lines in the main/sub title and using greek letters
Dear R-help, I am trying to express myself as best as I can here. If you also use Latex to edit math reports or other languages with similar editing method, you'll see what I'm talking about. My sincere appologies if my question is not clear enough to some extend, as also I'm not able to provide my code here because I don`t know which one I can use... When editing the title in R plots, such as using 'plot', or 'xyplot' in 'lattic', what method do you use to write greek letters and make use of superscript and subscript, e.g. to write mathematical expressions like using Latex: \sigma^2 \tau^{2s} \mu_i \pi_{2s} Also I would like to learn how to make two lines in the main title or sub title if the text I need it too long for putting in a single line, e.g. are there some R code/syntax allowing me to do something like in Latex to make two lines in the title, for example using '//' or '\\' to seperate the two parts of the text I want to put in two lines?? I heard about using something like plot(x,y, main=expression(....)) but from neither '?plot' or '?expression' could I find comprehensive information about what I need... Many thanks! HJ [[alternative HTML version deleted]]
Gerrit Eichner
2012-Mar-27 13:39 UTC
[R] Supperscript, subscript and double lines in the main/subtitle and using greekletters
Hi, HJ, see ?plotmath Hth -- Gerrit --------------------------------------------------------------------- Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eichner at math.uni-giessen.de Justus-Liebig-University Giessen Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/cms/eichner --------------------------------------------------------------------- On Tue, 27 Mar 2012, HJ YAN wrote:> Dear R-help, > > I am trying to express myself as best as I can here. If you also use Latex > to edit math reports or other languages with similar editing method, > you'll see what I'm talking about. My sincere appologies if my question is > not clear enough to some extend, as also I'm not able to provide my code > here because I don`t know which one I can use... > > When editing the title in R plots, such as using 'plot', or 'xyplot' in > 'lattic', what method do you use to write greek letters and make use of > superscript and subscript, e.g. to write mathematical expressions like > using Latex: > > \sigma^2 > \tau^{2s} > \mu_i > \pi_{2s} > > Also I would like to learn how to make two lines in the main title or sub > title if the text I need it too long for putting in a single line, e.g. are > there some R code/syntax allowing me to do something like in Latex to make > two lines in the title, for example using '//' or '\\' to seperate the two > parts of the text I want to put in two lines?? > > I heard about using something like > > plot(x,y, main=expression(....)) > > but from neither '?plot' or '?expression' could I find comprehensive > information about what I need... > > Many thanks! > HJ > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.
HJ YAN
2012-Mar-27 16:46 UTC
[R] Supperscript, subscript and double lines in the main/subtitle and using greekletters
Sorry last message was not completed before sending.... Please below.... On Tue, Mar 27, 2012 at 5:36 PM, HJ YAN <yhj204@googlemail.com> wrote:> Thank you very much Gerrit, for the nice hints! > > Just done some more googling and reaserches on this and trying to > answering it myself... > > Below is the code that works for double lines (adopted from Gerrit's > hints) and some of the formats (e.g. 1 and 3, but not 2 and 4) listed below: > > (1) \sigma^2 > (2) \tau^{2s} > (3) \mu_i > (4) \pi_{2s} > > plot(1:3, ylab = expression("Superscript in greek letters (" * mu^2 ~ "m)") > , xlab = expression("Subscript in greek letters" ~ mu[2]* ~ pi) > , main = expression(atop("Happy Easter" ,"to all R-Helpers"))) > > > For using greek letters, am still a bit confused when needing a > "*" though...e.g. seems it needs a "*" in front of greek letter > expressions, when applying 'expression ("...")'. And a "*" seems not > required when a greek letter is needed outside the double quotations, e.g. >when applying just 'expression(...)'. Again, a "*" is needed when making subscript as shown above... It seems "~" is reserved for making spaces before/between greek letters. What if we need "~" in the title as "~" is a standard notation in statistics when expressing "is from" when writing down a distribution, e.g. 'X~N(0,1)'... HJ> > > > > > > > > > > > > > > On Tue, Mar 27, 2012 at 2:39 PM, Gerrit Eichner < > Gerrit.Eichner@math.uni-giessen.de> wrote: > >> Hi, HJ, >> >> see >> >> ?plotmath >> >> Hth -- Gerrit >> >> ------------------------------**------------------------------**--------- >> Dr. Gerrit Eichner Mathematical Institute, Room 212 >> gerrit.eichner@math.uni-**giessen.de <gerrit.eichner@math.uni-giessen.de> Justus-Liebig-University Giessen >> Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany >> Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/cms/**eichner<http://www.uni-giessen.de/cms/eichner> >> ------------------------------**------------------------------**--------- >> >> >> >> On Tue, 27 Mar 2012, HJ YAN wrote: >> >> Dear R-help, >>> >>> I am trying to express myself as best as I can here. If you also use >>> Latex >>> to edit math reports or other languages with similar editing method, >>> you'll see what I'm talking about. My sincere appologies if my question >>> is >>> not clear enough to some extend, as also I'm not able to provide my code >>> here because I don`t know which one I can use... >>> >>> When editing the title in R plots, such as using 'plot', or 'xyplot' in >>> 'lattic', what method do you use to write greek letters and make use of >>> superscript and subscript, e.g. to write mathematical expressions like >>> using Latex: >>> >>> \sigma^2 >>> \tau^{2s} >>> \mu_i >>> \pi_{2s} >>> >>> Also I would like to learn how to make two lines in the main title or sub >>> title if the text I need it too long for putting in a single line, e.g. >>> are >>> there some R code/syntax allowing me to do something like in Latex to >>> make >>> two lines in the title, for example using '//' or '\\' to seperate the >>> two >>> parts of the text I want to put in two lines?? >>> >>> I heard about using something like >>> >>> plot(x,y, main=expression(....)) >>> >>> but from neither '?plot' or '?expression' could I find comprehensive >>> information about what I need... >>> >>> Many thanks! >>> HJ >>> >>> [[alternative HTML version deleted]] >>> >>> ______________________________**________________ >>> R-help@r-project.org mailing list >>> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> >>> PLEASE do read the posting guide http://www.R-project.org/** >>> posting-guide.html <http://www.r-project.org/posting-guide.html> >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >[[alternative HTML version deleted]]