Displaying 1 result from an estimated 1 matches for "f_angle".
Did you mean:
g_angle
2009 Aug 27
2
setting par(srt) according to plot aspect ratio
...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 Institut...