图例中的线宽?

Sta*_*ian 2 plot r

我想更改图例中线条的宽度。目前我有:

legend(-0.145, 25, c("(Gaussian) Kernel density","fitted normal distribution"),lwd=1.8, cex=0.8, 
   col=c("black","black"), lty=1:2)
Run Code Online (Sandbox Code Playgroud)

lwd 似乎改变了文本,但没有改变线条和虚线的宽度,我该怎么做?

jub*_*uba 6

我认为你错了,lwd在你的图例中设置线宽:

比较这个(顶图):

plot(rnorm(100)*13)
legend(-0.145, 25, c("(Gaussian) Kernel density","fitted normal distribution"),lwd=0.1, cex=0.8, 
   col=c("black","black"), lty=1:2)
Run Code Online (Sandbox Code Playgroud)

有了这个(底部图):

plot(rnorm(100)*13)
legend(-0.145, 25, c("(Gaussian) Kernel density","fitted normal distribution"),lwd=3, cex=0.8, 
   col=c("black","black"), lty=1:2)
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明