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

Henrik Bengtsson hb at stat.berkeley.edu
Sun Sep 21 18:53:39 CEST 2008


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



More information about the R-help mailing list