How can I look up the aspect ratio of a plot, so I can use that to correctly
adjust the angle of text which is supposed to be parallel to a line in the
plot?

The following example code works for a 1:1 aspect ratio, but puts the text
at the wrong angle if the plot region is short and wide or tall and narrow.
 I can't find a par() component containing the plot aspect ratio.  It will
be for png() or postscript() output, if that matters.

f <- function(x) x
g <- function(x) 2*x
(f_angle <- atan(1)*180/pi)
(g_angle <- atan(2)*180/pi)
xpos <- 0.2
plot(f)
plot(g,add=TRUE)
par(srt=f_angle)
text(xpos,f(xpos),label="y=x",pos=3)
par(srt=g_angle)
text(xpos,g(xpos),label="y=2x",pos=3)


-- 
Levi Waldron
post-doctoral fellow
Jurisica Lab, Ontario Cancer Institute
Division of Signaling Biology
TMDT 9-304D
101 College Street
Toronto, Ontario M5G 1L7
(416)581-7453

	[[alternative HTML version deleted]]


