[R-pkg-devel] R graphics 'text' package 'adj' parameter order wrong incorrect reversed?

peter dalgaard pd@lgd @ending from gm@il@com
Wed Sep 19 09:31:16 CEST 2018


Exactly. And left alignment means that the left end of the text is aligned with the anchor point, etc. So documentation is correct.

-pd

> On 19 Sep 2018, at 01:33 , Jim Lemon <drjimlemon using gmail.com> wrote:
> 
> Hi Simon,
> I think the conventions of typesetting are to blame. Think of an
> invisible box around the text being displayed.
> __________________
> |Left justification          |
> |-----------------------------|
> meaning that the text _starts_ at the left of the field and is to the
> right of the text position specified
> __________________
> |        Right justification|
> |-----------------------------|
> 
> meaning that the text _ends_ at the right of the field and is to the
> left of the text position. Can't do the top and bottom justification
> this way, but I think you get the idea.
> 
> Jim
> 
> On Wed, Sep 19, 2018 at 9:13 AM Simon Dedman <simondedman using gmail.com> wrote:
>> 
>> Original stack overflow post here:
>> https://stackoverflow.com/questions/52194719/r-graphic-text-package-adj-parameter-order-wrong-incorrect-reversed
>> 
>> Hopefully this is now the appropriate place to post this as the above post
>> got a single comment of agreement.
>> 
>> Content:
>> 
>> I believe R core package graphics text function's adj parameter is
>> incorrectly described in the manual
>> <https://stat.ethz.ch/R-manual/R-devel/library/graphics/html/text.html> and
>> would be grateful if someone could confirm this before I submit a bug report
>> <https://www.r-project.org/bugs.html>.
>> 
>> adj text:
>> 
>> adj allows adjustment of the text with respect to (x, y). Values of 0, 0.5,
>> and 1 specify left/bottom, middle and right/top alignment, respectively.
>> 
>> Since text controls these labels and not the points which have already been
>> plotted, I can't see how "with respect to x,y" can mean anything other than
>> "in this direction relative to their points".
>> 
>> However the order is reversed: 0,0 (supposedly left & bottom) is top &
>> right; 1,1 (supposedly right & top) is left and bottom.
>> 
>> Reproducible example:
>> 
>> tens = 1:10
>> plot(tens, tens, xlab = "adj 0,0 left/bottom")
>> text(tens, tens, labels = letters[tens], adj = c(0,0))
>> plot(tens, tens, xlab = "adj 0.5,0.5 middle")
>> text(tens, tens, labels = letters[tens], adj = c(0.5,0.5))
>> plot(tens, tens, xlab = "adj 1,1 right/top")
>> text(tens, tens, labels = letters[tens], adj = c(1,1))
>> 
>> Thanks.
>> 
>>        [[alternative HTML version deleted]]
>> 
>> ______________________________________________
>> R-package-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-package-devel mailing list