Skip to content

How to plot "greater than" symbol on the x-axis

9 messages · Bingshan Li, John Fox, Henrik Bengtsson +1 more

#
Dear Bingshan,

It isn't entirely clear what you want to do. I think that you want the
"greater-than-or-equal-to" symbol, not "greater than," but by itself or in
an expression? For the first, xlab=expression("" >= ""), and for the second,
e.g., xlab=expression(x >= x[min]). More generally, see ?plotmath.

I hope this helps,
 John 

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
On
in
http://www.R-project.org/posting-guide.html
#
Dear Bingshan,

You can use xlab=expression("" >= "1"), xlab=expression("" >= 1), or
expression(NA >= 1), etc. The point is that >= is a binary operator, so a
well formed expression needs both a left- and right-hand operand.

John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
make
second,
#
What have you tried this far and what part does not work?  If you
forget for a moment the fact that you want to have ">=1", ">=2", ...
can you do what you want with plain "1", "2", ...?  Telling us that
helps us help you.

Are you asking for the labels on the *tick marks* on the axis?  Right
now it sounds like you are asking for *the label* on the x axis, but
the part that you want multiple ones is confusing.

plot(1:10, xlab="1");

is different from:

plot(1:10, axes=FALSE);
axis(side=1, at=1:10, labels=1:10);

To add ">=" to the latter case, this works:

bquote("" >= 1:10)
labels <- lapply(1:10, FUN=function(x) substitute(>= t, list(t=x)));
plot(1:10, axes=FALSE);
axis(side=1, at=1:10, labels=labels);
On Sun, Sep 21, 2008 at 8:23 AM, Li, Bingshan <bli1 at bcm.tmc.edu> wrote:
#
On Sun, Sep 21, 2008 at 9:52 AM, Henrik Bengtsson <hb at stat.berkeley.edu> wrote:
Oops.  Forget about the bquote() - cut'n'paste error  ...and I don't
know how to get rid of the "" preceding each tick label.  Maybe
someone else knows.

/Henrik
#
On Sun, Sep 21, 2008 at 11:23 AM, Li, Bingshan <bli1 at bcm.tmc.edu> wrote:
Try this:

plot(1:10, xaxt = "n")
for(i in 1:10) axis(1, i, bquote(phantom(0) >= .(i)))
#
Hi Gabor,

This works. This is exactly what I want. According to John Fox's reply, 
I used expression(NA>=1) and it also worked. Thanks for the kind and 
clever help.

Bingshan
Gabor Grothendieck wrote: