very wide graph legend frame

I want to know how to make the margin of the legend look smaller and more centered, thank you very much in advance, greetings.

     ylab = "Precipitation [mm]",xlab = "Days", col="black",lwd=1, ylim = range(0,max(PP_muxobs)*1)) 
#
for (k in 1:10){#lo cambie a 1:!
  matplot(1:365,PP_muxCont[,,k],type="l" , add = TRUE, col=("gray"), lwd=2)
  #matplot(1:365,PP_muxHist[,,k],type="l" , add = TRUE, col=("gray"),lwd=2)
}
matplot(1:365,PP_muxobs,type="l" , add = TRUE, col=("black"), lwd=1)
legend(x = "topright",         # Posición
       c( "Observed" , "GCM Simulated" ), # Textos de la leyenda
       inset = 0.05,
       lty = c(1, 1),          # Tipo de líneas
       col = c("black","gray46"),          # Colores de las líneas
       cex = 0.8, # Cambiar el tamaño
       x.intersp=1.6,
       y.intersp=0.2,
       lwd = 1,  # Ancho de las líneas
       bty=0,
       box.lwd=1.5,
       adj=0.5) #texto centrado)```

![image|690x353](upload://aoBSW5zGQPWrveEFt4BTsVfUp4q.png)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.