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

Simon Dedman @imondedm@n @ending from gm@il@com
Wed Sep 19 17:00:40 CEST 2018


Thanks for your quick replies gents.

Jim I think the invisible box concept for typesetting is very useful and
key to the source of the issue: the documentation is referring to the
typesetting position within an invisible box, something (I would posit)
most users won't expect. So while the documentation is technically correct
as Peter says, that doesn't inherently make it intuitive which defeats the
purpose of documentation. Additionally, from the frame of reference of
typesetting, I would presume the default case (with documents etc) is that
the box - invisible or otherwise - would be static: the margins of an A4
page, for example, or a text box within a plot. In such cases, left/right
justification is simple and predictable. In this case the documentation's
omission of any reference to the invisible typesetting box creates the
issue.

Subsequently the documentation could be adjusted to include this concept,
viz:
   "Values of 0, 0.5, and 1 specify left/bottom, middle and right/top
alignment, respectively."
becomes (e.g.)
   "Values of 0, 0.5, and 1 specify left/bottom, middle and right/top
alignment, relative to an invisible typesetting box which is itself aligned
to the right/top, middle, and left/bottom of the anchor point,
respectively."
however introducing the typesetting box concept seems unnecessary: David's
proposed text neatly describes what the effect of value changes will be.
Please could this be adopted?

Thanks again.

sd

On Wed, 19 Sep 2018 at 00:55 David Hugh-Jones <davidhughjones using gmail.com>
wrote:

>
> Perhaps the documentation could be clearer, though. (I've been confused by
> it also.) How about:
>
> adj allows adjustment of the text with respect to (x, y). Values of 0, 0.5
> and 1 specify that text will appear right of/above, centred around, and
> left of/below the anchor point,  respectively.
>
> On Wed, 19 Sep 2018 at 08:31, peter dalgaard <pdalgd using gmail.com> wrote:
>
>> 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
>> <https://maps.google.com/?q=Solbjerg+Plads+3&entry=gmail&source=g>, 2000
>> Frederiksberg, Denmark
>> Phone: (+45)38153501 <+45%2038%2015%2035%2001>
>> Office: A 4.23
>> Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com
>>
>> ______________________________________________
>> R-package-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
> --
> Sent from Gmail Mobile
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list