[Rd] mtext adj= wrong with several las= (PR#7188)

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Aug 27 09:05:09 CEST 2004

Jens Oehlschlägel wrote:

>>No, adj moves not always along the axis:
> No, not yet. But mtext logically is oriented relative to its axis. And it
> should behave consistently relative to its axis. 
> Whichever solution is choosen finally, I think it is important, that the
> default parametrisation will handle multi-line labels such that they are
> centered around at= and aligned at line=, whatever side= and las= are
> choosen. Beeing forced to tweak with adj= / padj= depending on side= / las=
> would be very impractical. This "requirement" is easily fullfilled with
> default adj=0.5 if we have mtext's adj= always move along the axis. With a
> adj= / padj= solution, different defaults would be needed for the different
> combinations of side= and las=.

Might be nice, but I don't think we can easily change that much in 
mtext()'s behaviour. It is widely used in graphic functions and changing 
the defaults too much will break an incredible amount of code (if 
someone changes mtext() in that manner, I'll unsubsribe from R-help for 
half a year ;-)).

> How does it S+?

The outdated S-PLUS 4.5 behaves like R does, but the logic is different 
since you have to specify srt rather than las.

Uwe Ligges

> Best
> Jens
> # Thats my problem
> txt <- "This are\nfour lines\nof some\nrubish"
> y <- barplot(x, axes=FALSE, axisnames=FALSE, horiz=TRUE)
> # axis doesn't align it properly
> axis(2, label=rep(txt, 5), at=y, las=2, adj=0)
> # and no mtext parameters give vertically centered and right adjusted text
> mtext(rep(txt, 5), side=2, line=1, at=y, las=2, adj=0)

More information about the R-devel mailing list