An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080920/a950c97e/attachment.pl>
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
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Li, Bingshan Sent: September-21-08 12:37 AM To: r-help at r-project.org Subject: [R] How to plot "greater than" symbol on the x-axis Hello everyone, I want to plot a "greater than" symbol (the "_" under ">") on the x-axis
in
the labels. Is it possible to do it? Thanks. Bingshan [[alternative HTML version deleted]]
______________________________________________ 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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080921/b28c45e2/attachment.pl>
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
-----Original Message----- From: Li, Bingshan [mailto:bli1 at bcm.tmc.edu] Sent: September-21-08 11:24 AM To: John Fox Cc: r-help at r-project.org Subject: RE: [R] How to plot "greater than" symbol on the x-axis Hi John, Yes, you are right. I meant "greater-than-or-equal". According to your suggestion, I can plot the symbol only. But what I want is to have >=1, =2 and so on as labels on xaxis. I did not make it work. Do you know how to
make
it? The expression("">=1"") did not work, and paste(expression("">=""), 1)
did not work either.
Thanks a lot!
Bingshan
-----Original Message-----
From: John Fox [mailto:jfox at mcmaster.ca]
Sent: Sun 9/21/2008 8:38 AM
To: Li, Bingshan
Cc: r-help at r-project.org
Subject: RE: [R] How to plot "greater than" symbol on the x-axis
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
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Li, Bingshan Sent: September-21-08 12:37 AM To: r-help at r-project.org Subject: [R] How to plot "greater than" symbol on the x-axis Hello everyone, I want to plot a "greater than" symbol (the "_" under ">") on the x-axis
in
the labels. Is it possible to do it?
Thanks.
Bingshan
[[alternative HTML version deleted]]
______________________________________________ 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.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080921/da11b9e8/attachment.pl>
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:
Hi John,
Yes, you are right. I meant "greater-than-or-equal". According to your suggestion, I can plot the symbol only. But what I want is to have >=1, >=2 and so on as labels on xaxis. I did not make it work. Do you know how to make it? The expression("">=1"") did not work, and paste(expression("">=""), 1)
did not work either.
Thanks a lot!
Bingshan
-----Original Message-----
From: John Fox [mailto:jfox at mcmaster.ca]
Sent: Sun 9/21/2008 8:38 AM
To: Li, Bingshan
Cc: r-help at r-project.org
Subject: RE: [R] How to plot "greater than" symbol on the x-axis
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
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Li, Bingshan Sent: September-21-08 12:37 AM To: r-help at r-project.org Subject: [R] How to plot "greater than" symbol on the x-axis Hello everyone, I want to plot a "greater than" symbol (the "_" under ">") on the x-axis
in
the labels. Is it possible to do it?
Thanks.
Bingshan
[[alternative HTML version deleted]]
______________________________________________ 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. [[alternative HTML version deleted]] ______________________________________________ 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.
On Sun, Sep 21, 2008 at 9:52 AM, Henrik Bengtsson <hb at stat.berkeley.edu> wrote:
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);
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 8:23 AM, Li, Bingshan <bli1 at bcm.tmc.edu> wrote:
Hi John,
Yes, you are right. I meant "greater-than-or-equal". According to your suggestion, I can plot the symbol only. But what I want is to have >=1, >=2 and so on as labels on xaxis. I did not make it work. Do you know how to make it? The expression("">=1"") did not work, and paste(expression("">=""), 1)
did not work either.
Thanks a lot!
Bingshan
-----Original Message-----
From: John Fox [mailto:jfox at mcmaster.ca]
Sent: Sun 9/21/2008 8:38 AM
To: Li, Bingshan
Cc: r-help at r-project.org
Subject: RE: [R] How to plot "greater than" symbol on the x-axis
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
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Li, Bingshan Sent: September-21-08 12:37 AM To: r-help at r-project.org Subject: [R] How to plot "greater than" symbol on the x-axis Hello everyone, I want to plot a "greater than" symbol (the "_" under ">") on the x-axis
in
the labels. Is it possible to do it?
Thanks.
Bingshan
[[alternative HTML version deleted]]
______________________________________________ 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. [[alternative HTML version deleted]] ______________________________________________ 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.
On Sun, Sep 21, 2008 at 11:23 AM, Li, Bingshan <bli1 at bcm.tmc.edu> wrote:
Hi John,
Yes, you are right. I meant "greater-than-or-equal". According to your suggestion, I can plot the symbol only. But what I want is to have >=1, >=2 and so on as labels on xaxis. I did not make it work. Do you know how to make it? The expression("">=1"") did not work, and paste(expression("">=""), 1)
did not work either.
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:
On Sun, Sep 21, 2008 at 11:23 AM, Li, Bingshan <bli1 at bcm.tmc.edu> wrote:
Hi John,
Yes, you are right. I meant "greater-than-or-equal". According to your suggestion, I can plot the symbol only. But what I want is to have >=1, >=2 and so on as labels on xaxis. I did not make it work. Do you know how to make it? The expression("">=1"") did not work, and paste(expression("">=""), 1)
did not work either.
Try this: plot(1:10, xaxt = "n") for(i in 1:10) axis(1, i, bquote(phantom(0) >= .(i)))