[R] Rotated mtext

Paul Murrell paul at stat.auckland.ac.nz
Mon Feb 12 03:07:38 CET 2001


Hi


> >>Works for me (R-1.2.1, NT4.0):
> >>
> >> par(las=1)
> >> plot(1:10)
> >> mtext("A", 4, line=1)
> >
> > This works for me too on Solaris 2.7 (R-1.2.1):
> >
> > par(las=1)
> > plot(1:10)
> > mtext("top", side=3)     # the text is
> > mtext("right", side=4)   # horizontal
> >
> > par(las=2)
> > plot(1:10)
> > mtext("top", side=3)     # the text is
> > mtext("right", side=4)   # perpendicular to the axis
>
> This simple example works for me, too. I think my problem is that I have
some
> other parameters on the line which prevents las or srt from working
correctly.
> Here's the line I'm trying to print:
>
> >   mtext(rev(rownames(mdfname.2))[i], side=4,  outer=T,
> +  at=(((i-1) * 2 + 1) /(2* rowdim)), cex=0.7, las=2, srt=90)
>
> Maybe it's the at that's preventing it from working. Is there a way around
this?


The "problem" is that you have outer=T.   This is a bug in mtext() - it
basically ignores the setting of las.  I'm looking at some fixes to mtext()
and will include a change for this.  In the meantime, you might be able to
use mtext(..., outer=F, line=par("mar")[4], ...) to fake text in the outer
margin.  For example, try ...

plot(1:10)
box("inner", lty="dashed")
mtext(0:7, side=3, line=0:7)

Paul





-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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