Thank you again David for the thoughtful comments on plotmath. Really appreciated.
John ----- Original Message ---- From: David Winsemius <dwinsem...@comcast.net> To: array chip <arrayprof...@yahoo.com> Cc: Peter Ehlers <ehl...@ucalgary.ca>; R <r-help@r-project.org> Sent: Tue, June 28, 2011 12:20:49 PM Subject: Re: [R] how to print "<=" in plot title On Jun 28, 2011, at 2:52 PM, array chip wrote: > Thank you David for the obvious fix and sorry for my lacking innovative spirit, > :-) > > Really, I know I haven't grasped the essence of plotting these math symbols in > R. A lot of people (including me) have had trouble understanding to to write proper plotmath code. Here's my 10 cent version of an intro...things that were not clear to me on first, second, or third reading of the help(plotmath) page. (I am not saying these things are not in the page, just that they were not clear to me after multiple efforts at digestion. Searching r-help archives for worked examples was the most productive learning strategy.) The stuff on left side of the table in the plotmath help page represent the "special words and symbols" and they need to be separated with the proper operators, since spaces are ignored (as actually happens in R parsing as well but we are generally shielded form that fact). Words other than these specials can be entered without quotes since expressions are not evaluated. The list of greek letters is not complete. Not all of the script greeks work. The "*" and "~" operators are the usual way to separate plotmath sub-expressions with either no-space or space displayed respectively. Commas are also special in separating individual expression values, so don't use them unless you want a multiple expression value (or need them inside a plotmath 'paste' or 'list'). You generally do not want multiple values of expression vector when constructing 'main' or 'sub' arguments, but may need them when constructing labels for plot axes. Only use quotes when they are really needed. You need to construct the arguments so that infix operations have flanking operands and notice that the plotmath paste function has no sep argument. > > John > > > > ----- Original Message ---- > From: David Winsemius <dwinsem...@comcast.net> > To: array chip <arrayprof...@yahoo.com> > Cc: Peter Ehlers <ehl...@ucalgary.ca>; R <r-help@r-project.org> > Sent: Tue, June 28, 2011 11:50:02 AM > Subject: Re: [R] how to print "<=" in plot title > > > On Jun 28, 2011, at 2:42 PM, array chip wrote: > >> David, >> >> I tried your suggestion, still not working: >> >> x<-3 >> plot(1:10) >> title(bquote(bold(x) <= bold(as.character(.(x)) ))) >> >> >> It prints x<=as.character(3) as title > > Kids these days! No innovative spirit. Why in my day... they would be > jumping with the obvious fix to an elder's error. > > x<-3 > plot(1:10) > title( bquote(bold(x) <= bold(.(as.character(x)) ))) > > --David. >> >> Thanks >> >> John >> >> >> >> ----- Original Message ---- >> From: David Winsemius <dwinsem...@comcast.net> >> To: array chip <arrayprof...@yahoo.com> >> Cc: Peter Ehlers <ehl...@ucalgary.ca>; R <r-help@r-project.org> >> Sent: Tue, June 28, 2011 11:30:23 AM >> Subject: Re: [R] how to print "<=" in plot title >> >> >> On Jun 28, 2011, at 2:19 PM, array chip wrote: >> >>> Thank you David and Bert. >>> >>> x<-3plot(1:10) >>> title(bquote( x <= .(x) )) >>> >>> would do what I want. But I also want the title printed in bold >>> font. so I >>> tried >>> >>> x<-3 >>> plot(1:10) >>> title(bquote(bold(x <= .(x)) )) >>> >>> But this did not print the "less than equal to" symbol and the >>> number 3 (from >>> variable x) in bold. Anyway to solve that? >> >> Nope. The Symbol font has no bold type face. Bolding of numbers >> _can_ be done >> inside bquote with bold(as.character(.(x)) ) >> >> --David >>> >>> Thanks again! >>> >>> John >>> >>> >>> >>> >>> ----- Original Message ---- >>> From: David Winsemius <dwinsem...@comcast.net> >>> To: Peter Ehlers <ehl...@ucalgary.ca> >>> Cc: array chip <arrayprof...@yahoo.com>; R <r-help@r-project.org> >>> Sent: Tue, June 28, 2011 11:04:07 AM >>> Subject: Re: [R] how to print "<=" in plot title >>> >>> >>> On Jun 28, 2011, at 1:52 PM, Peter Ehlers wrote: >>> >>>> On 2011-06-28 10:25, array chip wrote: >>>>> Hi, how can I print "<=" (I mean the symbol of just one >>>>> character) in the >>> main >>>>> title of a plot? >>>>> >>>>> for example: >>>>> >>>>> plot(1:10, main=paste("x<=", x)) >>>>> >>>>> where variable x is some number generated on the fly. >>>> >>>> x <- 2.718 >>>> plot(0, 0) >>>> title(bquote( x %<=% .(x) )) >>> >>> I think John wants the mathematical symbol. As was pointed out in a >>> question >>> last week, the `<=` plotmath symbol needs to be flanked by operands. >>> Non-printing operands can be created with the phantom function: >>> >>> title(main=expression(phantom("")<=phantom("")) ) >>> >>> Contrary to Gunters's comment, this is probably going to work on >>> all the three >>> major OS platforms. It depends only on whether there is a Symbol >>> font mapped >> to >>> the output device. >>>> >>>> ?plotmath >>> >>> Yes. The details are there. >>> >>>> >>>> Peter Ehlers >>>> >>> >>> >>> David Winsemius, MD >>> West Hartford, CT >> >> David Winsemius, MD >> West Hartford, CT > > David Winsemius, MD > West Hartford, CT David Winsemius, MD West Hartford, CT ______________________________________________ R-help@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.