[R] Bold Face in Plot

Dieter Menne dieter.menne at menne-biomed.de
Mon Mar 2 15:29:24 CET 2009


Rau, Roland <Rau <at> demogr.mpg.de> writes:


> I am trying to plot some text in bold face which works fine:
> 
> plot(0:1,0:1,type="n")
> text(x=0.5, y=0.5, labels=expression(bold("the-actual-string")))
> 
> Now when I try to do the following, the displayed text reads thestring:
> 
> thestring <- "the-actual-string"
> plot(0:1,0:1,type="n")
> text(x=0.5, y=0.5, labels=expression(bold(thestring)))
> 

"expression" can be mind twisting. For a probably more realistic example, 
see the following:

plot(0:1,0:1,type="n")
ss1 = paste("there was ",expression(Delta))
ss = substitute(paste("there was ",expression(Delta)))
text(x=0.3, y=0.3, labels=ss1)
text(x=0.4, y=0.4, labels=ss)


Dieter




More information about the R-help mailing list