There are two ways to create rotated axis labels in R:
text(srt = angle)
mtext(las = 1)
Is there a way to add rotated axis labels of whom the y position does not depend on the scaling of the y axis?
Thinking about the problem, I found a solution making use of the ylim
parameter to the plot()
function:
ylim = c(0, 0.5)
plot(...)
text(..., srt = 45, y = 0.2 * (ylim[2] - ylim[1]))
dynamically adjusts the position of the text according to the scaling of the y axis.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With