[R] axis label rotation
Chris Jeffery
cjeff at geog.ubc.ca
Tue Dec 12 00:10:49 CET 2000
On Mon, 4 Dec 2000, Paul Murrell wrote:
> Hi
>
>
> > I recently switch over from Splus to R and I have not been able to
> > generate right axis labels that face inwards. This is accomplished
> > in Splus with the command srt=270 but this option is not supported
> > in R. In addition the par argument las=0 or 3 does not rotate the
> > right axis labels.
>
>
> Unfortunately, R's axis() and mtext() functions only listen to par(las) to
> determine text rotation (i.e., they ignore par(srt)) and they only choose
> between srt=0 and srt=90. This is actually documented behaviour (see
> help(par)), but I doubt that is much help to you :)
>
>
> > The editor of a journal is demanding that the right axis labels face
> > inwards in the figures I recently submitted. I am really at a loss
> > because these editors are inflexible with respect to their in-house
> > journal styles.
>
>
> This is not pretty, but if I have understood correctly it should do what you
> want ...
>
> par(xpd=T) # so that text() will draw outside of the plotting region
> plot(1:10) # replace this with your plotting commands
> axis(4, labels=F) # draw axis ticks but no labels
> text(rep(11, 5), seq(2,10,2), seq(2,10,2), srt=270) # draw tick labels
> by hand
>
> ... where I have used `rep(11, 5)` for the x-locations of the labels, you
> will need to experiment to get the placing right. You will also need to
> replace the `seq(2,10,2)` bits with appropriate y-locations too. The
> problem with the x-locations is that this is trying to locate the text
> within the plot margins by specifying x-locations in terms of the user
> coordinate system. As I said, it is not pretty :)
>
> Paul
>
Thanks Paul,
That did the trick.
Chris Jeffery
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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