manli001
manli001

Reputation: 33

change direction mtext x label

I've found plenty of posts about changing the direction of x labels using las(), but I haven't found much about how to manipulate mtext(). I've used mtext to supplement a figure using the following code:

arrows(3.85, 0.5, 3.85, 0.05,lwd=3, length=.1, xpd = TRUE)
mtext(side=4, "Increasing precipitation", font=2,line=2)

I'm placing it on the y axis of right side of the figure but the text still reads from bottom to top and looks strange. Is there a way to flip this text so it reads top to bottom? Using las() and others only seems to allow me to change it from parallel to perpendicular. Thanks.

Upvotes: 3

Views: 4021

Answers (1)

rawr
rawr

Reputation: 20811

I think text would be easier. If you use mtext, you'd have to use side = 2 and mess with the line argument unless there is a way to rotate the mtext labels that I don't know of.

plot(0, bty = 'l')
p <- par('usr')
text(p[2], mean(p[3:4]), labels = 'Some text', xpd = NA, srt = -90)

enter image description here

Upvotes: 4

Related Questions