Bob Bob - 5 months ago 12
R Question

In R, how do I set the specific location of an axis label?

I manually added in some tick marks, but these tick marks are too close and thus overlap with numbers already there. I can specify the exact location for these number labels? Here is an example picture of my problem. I tried changing the size, but there is still overlap.

enter image description here


You can use the mtext function to manually add text on the margins. The line and at arguments give the position of the text. See ?mtext for more details.

plot(x=1:4, y=1:4)
mtext(c(2.6, 3.4), side=2, line=0, at=c(2.6, 3.4))

enter image description here