[R] Changing mtext direction, or using text for the margin?

Michael Rennie mdrennie at gmail.com
Mon Jan 7 07:00:29 CET 2013

Hi all,

I have read through the archives, but can't find a solution to this problem.

I need the text direction on "dependent B", plotted in margin 4, to go 
top to bottom (opposite what it is now). Here's some sample code:

#plot with mtext example

par(mgp = c(2,1,0), mfrow=c(2,2), las=1, mar=c(2,2,2,2), omi= 


plot(a~b, ylab="", xlab="", xaxt="n")
axis(1, at=b, labels=FALSE, tick=TRUE)
plot(c~b, ylab="", xlab="", xaxt="n", yaxt="n")
axis(1, at=b, labels=FALSE, tick=TRUE)
axis(4, at=c(22,24,26,28,30), labels=TRUE, tick=TRUE)
plot(a~b, ylab="")
plot(c~b, ylab="", yaxt="n")
axis(4, at=c(22,24,26,28,30), labels=TRUE, tick=TRUE)

mtext(side=1, "independent", outer=TRUE, line=1, padj=1)
mtext(side=2, "dependent A", las=0, outer=TRUE, line=0.25)
mtext(side=4, "dependent B", las=0, outer=TRUE, line=0.25)

I have seen an example in help where i can use text and (srt) to 
manipulate this with a single panel plot, but not for a multi-panel 
example. Any help would be greatly appreciated.



More information about the R-help mailing list