mtext: smaller labels description when layout is u

2019-06-12 12:15发布

问题:

Using mtext for the label description does something different than using xlab. How can I make the mtext labels be always the same size as it would be when using xlab (without defining always the cex argument). In the minimal example below cex=cex.lab=1 for both figures. However the size is different.

layout(matrix(c(1,1,2,2), ncol=1))
op<-par(mar=c(4,4,2,1))
plot(1:10, xlab="", ylab="", main="This is my title")
mtext("this is the x-axis", side=1, line=2.75, cex=1)
mtext("this is the y-axis", side=2, line=2.5, cex=1)
plot(1:10,  xlab="this is smaller", ylab="this is smaller", main="This is my title", cex.lab=1)
par(op)

回答1:

When layout is used, the meaning of cex=1 in plot is different, but I would not have expected that difference to extend to mtext since its activities are outside the individual plotting regions. You can reverse the default reduction in "effective"-cex inside plot by inverting the expected factor of 2/3:

layout(matrix(c(1,1,2,2), ncol=1))
op<-par(mar=c(4,4,2,1))
plot(1:10, xlab="", ylab="", main="This is my title")
mtext("this is the x-axis", side=1, line=2.75, cex=1)
mtext("this is the y-axis", side=2, line=2.5, cex=1)
plot(1:10,  xlab="this is _not_ smaller", 
            ylab="this is _not_ smaller, either", 
            main="This is my title", 
            cex.lab=3/2)
par(op)

Further reading:

 ?par  # scroll down to mfcol, mfrow