Bob Bob - 1 year ago 72
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

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download