如何删除与r图例中的符号相交的线条?看了看传奇但似乎无法找到答案..
plot.new()
legend("top",ncol=1,c("Mound reef (M)","Spur and Groove (SG)",
"Rubble Fields (RF)","Coral Walls (CW)","Mounds and rubble fields (MR)",
"Mounds, Monostand walls and Rubble (MMR)"),pch=3:8, title="Reef Types",
cex=1, lwd=2)
答案 0 :(得分:4)
只需添加lty=NULL
plot.new()
legend("top",ncol=1,c("Mound reef (M)","Spur and Groove (SG)",
"Rubble Fields (RF)","Coral Walls (CW)",
"Mounds and rubble fields (MR)",
"Mounds, Monostand walls and Rubble (MMR)"),
pch=3:8, title="Reef Types",cex=1,lwd=2, lty=NULL)
修改强>
正如Josh O'Brien所指出的,删除lwd=2
就足够了,所以,你的代码应该是:
plot.new()
legend("top",ncol=1,c("Mound reef (M)","Spur and Groove (SG)",
"Rubble Fields (RF)","Coral Walls (CW)",
"Mounds and rubble fields (MR)",
"Mounds, Monostand walls and Rubble (MMR)"),
pch=3:8, title="Reef Types",cex=1)
答案 1 :(得分:3)
您只是因为指定了lwd=2
而获得了这些行,告诉您希望“{width} = 2”的legend()
函数。如果您不想要行,只需删除lwd=
参数。