I know it is going to be quick and simple for some of you. I just want to have a horizontal y axis label using mtext(). It has to do with adj I guess, but I have been wasting the last 2 hours trying to figure it out…
In the following examples, I just want the y-labels (myLab) to be horizontal and left justified.
myLab <- c("aaaaaaa", "bb", "c")
par(oma=c(0,10,0,0)) # make a large left maring for the labels
plot(x=c(1:3),
y=c(1:3),
pch="|",
lwd=3,
tck=0.01,
yaxt="n",
ylab="",
xlab="my legend",
at= c(1:3),
)
mtext(text=myLab,
side=2,
outer = FALSE,
at=c(1:3)
)
I do not need to use mtext(). If you have a better alternative, please let me know.
Thanks!
Use the las argument:
Brings them right up the edge but you can pad with trailing spaces in the myLab values. You can left justify using an
adjvalue of 0 (versus the default value of 1):