From: Marc Schwartz <MSchwartz_at_mn.rr.com>

Date: Fri 09 Jun 2006 - 23:27:37 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 10 00:47:27 2006

Date: Fri 09 Jun 2006 - 23:27:37 EST

On Fri, 2006-06-09 at 14:13 +0100, d d sutcliffe@durham ac uk wrote:

*> Hi,
**>
*

> I have been working through one of the examples on the FAQ about

*> rotating the labels on the x axis, I need to do the same but for the y
**> axis. I have managed to change some of the code, but I am still not
**> getting there, there is still something wrong. My syntax is as follows:
**>
**>
**> > par(mar = c(5, 7, 4, 2) + 0.1)
**> > plot(1 : 8, yaxt = "n", ylab = "")
**> > axis(2, labels = FALSE)
**> > labels <- paste("Label", 1:8, sep = " ")
**> > text(1:8, par("usr")[3] - 0.25, srt = 45, adj = 1,
**> + labels = labels, xpd = TRUE)
**>
**> If anybody knows what is wrong then I would appreciate your help...been
**> working on this for far too long already!
**>
**> Regards,
**>
**> Dan
*

Dan,

You need to adjust two things:

- par("usr")[3] is the minimum value of the y axis. You would use this (as in the FAQ example) when you want to move the text vertically below the x axis. See ?par for more information.

In your case, you want to move the text to the left of the y axis. Thus you need to use par("usr")[1] instead, which is the minimum value of the x axis.

2. In the text call, you are setting the 'x' coordinate to 1:8, which is why the labels are appearing along the x axis, rather than along the y axis. So you want to set the y coordinate to 1:8 instead.

So, the adjusted sequence would be:

par(mar = c(5, 7, 4, 2) + 0.1)

plot(1 : 8, yaxt = "n", ylab = "")

axis(2, labels = FALSE)

labels <- paste("Label", 1:8, sep = " ")

text(par("usr")[1] - 0.25, 1:8, srt = 45, adj = 1,

labels = labels, xpd = TRUE)

**HTH,
**
Marc Schwartz

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 10 00:47:27 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Sun 11 Jun 2006 - 05:34:53 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*