我在图例中有几个框,并希望增加其中一些的线宽以匹配图中的线宽。
R代码为空白
plot( 1, type = 'n')
图例的R代码-使用lwd
不会更改框的线宽
legend("topright",
legend = c("2005 CA II Stations", "2005 Survey Domain",
"CA II Access Area","CA II Groundfish Closed Area",
"Trawl Strata","SAMS Areas","Statistical Areas"),
bg = "white", pt.cex = c(2, NA, NA, NA, NA, NA, NA),
cex = 1, bty = "n",
pch = c(19, NA, NA, NA, NA, NA, NA),
col = c("red", NA, NA, NA, NA, NA, NA),
fill = c(NA, "gray", "gray", "white", "white", "white", "white"),
lwd = c(NA, 2, 2, 3, 1, 2, 1),
border = c(NA, "black", "black", "black", "gray", "red", "blue"),
x.intersp = 0.5, seg.len = 0.8, y.intersp = 1)
答案 0 :(得分:1)
使用带有pch
自变量的lwd
,例如pch = 22
,实心方块。如果要独立于图例中的任何线条设置点的线宽,请使用pt.lwd
。
plot(1, type = 'n')
legend("topright", legend = c("2005 CA II Stations", "2005 Survey Domain",
"CA II Access Area", "CA II Groundfish Closed Area",
"Trawl Strata", "SAMS Areas", "Statistical Areas"),
bty = "n",
lty = 0,
pch = c(19, rep(22, 6)),
pt.cex = 2,
pt.bg = c(NA, "gray", "gray", "white", "white", "white", "white"),
pt.lwd = c(NA, 2, 2, 3, 1, 2, 1),
col = c("red", "black", "black", "black", "gray", "red", "blue"))