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

______________________________________________
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.

Reply via email to