通过r中图例中的符号删除线条

Eli*_*eth 5 plot r legend

如何删除与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)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Jil*_*ina 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)
Run Code Online (Sandbox Code Playgroud)

编辑

lwd=2正如 Josh O'Brien 指出的那样,删除就足够了,因此,您的代码应该是:

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)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述