Pregunta

Usar mtext para la descripción de la etiqueta hace algo diferente a usar xlab.¿Cómo puedo hacer que las etiquetas de texto m tengan siempre el mismo tamaño que cuando uso xlab (sin definir siempre el argumento cex)?En el ejemplo mínimo siguiente cex=cex.lab=1 para ambas figuras.Sin embargo el tamaño es diferente.

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)

enter image description here

¿Fue útil?

Solución

Cuando se utiliza el diseño, el significado de cex=1 en plot es diferente, pero no hubiera esperado que esa diferencia se extendiera a mtext ya que sus actividades están fuera de las regiones de trazado individuales.Puede revertir la reducción predeterminada en "efectivo"-cex adentro plot invirtiendo el factor esperado de 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)

Otras lecturas:

 ?par  # scroll down to mfcol, mfrow
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top