[R-es] posición leyenda

Carmen Guzmán gu@te@p@|n @end|ng |rom gm@||@com
Jue Mayo 28 17:53:30 CEST 2020


  Hola tod using s, al utilizar 2 gráficos en uno con *par(mfrow=c(1,2)), *solo
deseo poner leyenda por dentro a uno de los gráficos. Lo he hecho, pero
deseo que la leyenda quede mas cerca del borde, ya que al máximizar la
ventana extra x11(), la leyenda sale casi a la mitad del gráfico a pesar de
usar topright con el código  legend('topright', legend =
levels(Presas$Season), col = 1:4,
cex = 0.7, pch = 16).
Copio todo el código a continuación. Gracias


x11()
par(mfrow=c(1,2), mar=c(5,5,5,1) + .1)

I.nought = -15.479969
I1 = I.nought + 0
I2 = I.nought + -0.319291
I3 = I.nought + -5.606254
B  = 0.051463

plot(x   = Presas$Lat,
     y   = Presas$C,
     col = Presas$Season,
     pch = 16,
     xlab = "Latitude",
     ylab = "C")

abline(I1, B,
       lty=1, lwd=2, col = 1)

abline(I2, B,
       lty=1, lwd=2, col = 2)

abline(I3, B,
       lty=1, lwd=2, col = 3)

legend("topleft", c("a"),
       inset=c(0,-0.07), xpd=TRUE, horiz=TRUE, bty="n"
)

I.nought = 26.34891
I1 = I.nought + 0
I2 = I.nought + 0.84785
I3 = I.nought + -13.00021
B  = -0.13421

plot(x   = Presas$Lat,
     y   = Presas$N,
     col = Presas$Season,
     pch = 16,
     xlab = "Latitude",
     ylab = "N")

legend('topright',
       legend = levels(Presas$Season),
       col = 1:4,
       cex = 0.7,
       pch = 16)

abline(I1, B,
       lty=1, lwd=2, col = 1)

abline(I2, B,
       lty=1, lwd=2, col = 2)

abline(I3, B,
       lty=1, lwd=2, col = 3)

legend("topleft", c("b"),
       inset=c(0,-0.07), xpd=TRUE, horiz=TRUE, bty="n"
)

	[[alternative HTML version deleted]]



Más información sobre la lista de distribución R-help-es