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

From: <ligges_at_statistik.uni-dortmund.de>
Date: Fri 20 Aug 2004 - 23:34:05 EST


joehl@gmx.de wrote:

> Dear all,
>
> Our quite basic function mtext() does wrong adjustments in some parameter
> configurations. This gets obvious when using multi line texts: There is no
> way to properly adjust text perpendicular to axis 2, for example.
>
> Best
>
>
> Jens Oehlschlägel
>
>
> m <- matrix(1:9, 3)
> colnames(m) <- c("several\nlines", "several\nlines", "several\nlines")
>
> par(mfrow=c(2,2))
> barplot(m, horiz=TRUE, axes=FALSE, axisnames=FALSE, main="las=0 adj=0.5 is
> fine")
> mtext(colnames(m), 2, at=seq(0.5+0.2, by=1+0.2, length=3), las=0, adj=0.5)
> barplot(m, horiz=TRUE, axes=FALSE, axisnames=FALSE, main="las=0 adj=1 is
> different")
> mtext(colnames(m), 2, at=seq(0.5+0.2, by=1+0.2, length=3), las=0, adj=1)
> barplot(m, horiz=TRUE, axes=FALSE, axisnames=FALSE, main="las=1 adj=0.5 is
> NOT fine")
> mtext(colnames(m), 2, at=seq(0.5+0.2, by=1+0.2, length=3), las=1, adj=0.5)
> barplot(m, horiz=TRUE, axes=FALSE, axisnames=FALSE, main="at las=1, adj=1
> works the wrong direction", sub="no way to get adj=c(1, 0.5) with las=1 (or
> 2)")
> mtext(colnames(m), 2, at=seq(0.5+0.2, by=1+0.2, length=3), las=1, adj=1)
> par(mfrow=c(1,1))
>

Left / right adjustemnt seems to be perfectly OK. The thing that matters is centering "several lines" to the specified ("at=") location.
In fact, mtext() is not centering but bottom-aligning by adding a negative distance that looks OK for one line in the default font size, but not in most other cases.

Hence this is the same as Paul Murrell's PR#1659 ("mtext() alignment of perpendicular text"). Fixing this, and/or improving mtext()'s "adj" argument to accept 2 dimensions is desirable, but might be not that easy... I'll take a look during the next days, but nothing promised.

Uwe Ligges

>>version
>
> _
> platform i386-pc-mingw32
> arch i386
> os mingw32
> system i386, mingw32
> status
> major 1
> minor 9.1
> year 2004
> month 06
> day 21
> language R
>
>



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Aug 20 23:36:24 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 08:59:21 EST