[R] Align expression and text in mtext()
David Winsemius
dwinsemius at comcast.net
Fri Dec 9 15:12:08 CET 2011
On Dec 8, 2011, at 9:53 PM, Remko Duursma wrote:
> Dear R-helpers,
>
>
> I have trouble aligning an expression with a subscript, and text, in
> margin
> text:
>
> par(mar=c(6,6,1,1))
> b <- barplot(1:3)
> mtext(c("A","B","C"), at=b, side=1, line=1, cex=1.3)
> mtext(expression(italic(C)[a]~(more~text)), at=0, line=1,
> side=1,cex=1.3)
>
>
> As explained in the help files and elsewhere, I understand that the
> expression is aligned by the bounding box, not the lower end of the
> 'text'
> in the expression. Playing with adj or padj in mtext() does not
> really solve
> this?
>
> Any suggestions or workarounds?
>
> PS, I tried using a phantom() expression for the text bits; but this
> messes
> up the horizontal alignment).
>
I couldn't understand from your statement what you were "having
trouble" with achieving, and even after running your example I am
still not clear. If your goal is to get the bottom the the expression
lined up with the bottom of the axis labels inserted with mtext then
try padj=.2
--
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list