[R] Bold Face in Plot

Greg Snow Greg.Snow at imail.org
Tue Mar 3 04:58:12 CET 2009


Here is one way:

thestring <- "the-actual-string"
plot(0:1,0:1,type="n")
text(x=0.5, y=0.5, labels=bquote(bold(.(thestring))))

There is an example in the plotmath help page that shows using bquote (but that page has so much information that I did not find it on my first scan through even knowing what to look for).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Rau, Roland
> Sent: Monday, March 02, 2009 6:46 AM
> To: r-help at r-project.org
> Subject: [R] Bold Face in Plot
> 
> Dear all,
> 
> 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)))
> 
> Can someone tell me what I am doing wrong? I assume it is rather simple
> but I am stuck somehow.
> 
> Thanks in advance,
> Roland
> 
> P.S. I tried it using ("ancient") R 2.7.0 on Windows32 and version
> 2.8.1
> on GNU/Linux (Ubuntu 8.10).
> 
> ----------
> This mail has been sent through the MPI for Demographic Research.
> Should you receive a mail that is apparently from a MPI user without
> this text displayed, then the address has most likely been faked. If
> you are uncertain about the validity of this message, please check the
> mail header or ask your system administrator for assistance.
> 
> ______________________________________________
> 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.




More information about the R-help mailing list