[R] Text adjustment outside (0,1)

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Aug 3 11:06:37 CEST 2001


On Fri, 3 Aug 2001, BXC (Bendix Carstensen) wrote:

> Funnily enough, it seems that adjustment of text in the verical
> direction is more flexible than in the horizontal. Horizontal
> adjustment parameters, seem to be set to the closest of 0 and 1
> if they fall outside (0,1). Try e.g.:
>
> plot(0:1,0:1)
> for (a in seq(-5,5,0.5) ) text(0.5, 0.5, "Y", adj=c(0,a), cex=2, col="red" )
> for (a in seq(-5,5,0.5) ) text(0.5, 0.5, "X", adj=c(a,0), cex=2, col="blue"
> )
>
> Any particular reason for this restriction in the horizontal direction?

Horizontal adjustment makes use of driver capabilities: vertical
adjustment does not.  So in fact it is driver-dependent, and the X11 and
postscript drivers do not have this restriction.  I assume you are on
Windows NT, although you did not say so ....

However, this is documented not to work, as ?text says

     adj: one or two values in [0,1] which specify the x (and
          optionally y) adjustment of the labels.

and that restriction is imposed for devices with dd->dp.canHAdj == 1.

So either we should be adding a new feature (and changing the
documentation accordingly), or imposing the restriction on all devices.

Note ?par says

     adj: The value of `adj' determines the way in which text strings
          are justified.  A value of `0' produces left-justified text,
          `0.5' centered text and `1' right-justified text.  Note that
          the `adj' argument of `text' also allows `adj = c(x,y)' for
          different adjustment in x- and y- direction.

which suggests only three values are allowed.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list