R Graphics: axis mark relative to tick marks?

I wanted to make a simple R chart with Y axis labels centered over the y axis label labels. I created something that I liked using the code below. But this required some distortion with the graphic parameter at.

Q: Is there a less hacky way to do this? Is there a way to request y-axis label labels for their width so that I can use this information to center the y-axis label over them?

set.seed(1)
n.obs       <- 390
vol.min     <- .20/sqrt(252 * 390)
eps         <- rnorm(n = n.obs, sd = vol.min)
windows(width = 5.05, height = 3.8)
plot(eps,  main  =  "Hello  World!", las=1, ylab="")
mtext(text="eps", side=3, at=-60)

my plot

+5
source share
1 answer

par ( "usr" ), . wringle, . 7 x 7 :

mtext(text="eps", side=3, at=usrcoord.x.left-0.075*diff(range(par("usr")[1:2]) ))

:

mtext(text="eps", side=3, at=usrcoord.x.left-0.1*diff(range(par("usr")[1:2]) ))
+2

All Articles