[R] bquote question

David Winsemius dwinsemius at comcast.net
Sat Aug 19 08:27:42 CEST 2017


> On Aug 18, 2017, at 7:27 AM, Andras Farkas via R-help <r-help at r-project.org> wrote:
> 
> Dear All,
> 
> could you please provide input on the following:
> 
> plot(1:10,main=paste("\n   ","\nABCD","\n    ","\n    ","\n    "),cex.main=1.3) 
> 
> a<-500 
> b<-12 
> mtext(bquote(bold(.(formatC(1.2*a,decimal.mark=",",digits=2,format="f")))~ " words "~bold(.(b))~" words"~"\n    "~"\n    ")) 
> 
> 
> 
> as you will see form the sub-title only the result of  formatC(1.2*a,decimal.mark=",",digits=2,format="f") gets bolded, while the part bold(.(b)) does not seem to bold the letter 'b'... In addition, the spacing ("\n ") at the end of the mtext line also does not seem to get recognized.... any thoughts on what I may be doing wrong?

Failing to read the ?plotmath page. Numeric values do not get bolded. You will need to wrap with as.character(). And "\n"'s are not recognized. 

-- 
David.


More information about the R-help mailing list