[R] how to print "<=" in plot title

array chip arrayprofile at yahoo.com
Tue Jun 28 20:42:31 CEST 2011


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

Thanks

John



----- Original Message ----
From: David Winsemius <dwinsemius at comcast.net>
To: array chip <arrayprofile at yahoo.com>
Cc: Peter Ehlers <ehlers at ucalgary.ca>; R <r-help at 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 <dwinsemius at comcast.net>
> To: Peter Ehlers <ehlers at ucalgary.ca>
> Cc: array chip <arrayprofile at yahoo.com>; R <r-help at 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



More information about the R-help mailing list