简体   繁体   English

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

[英]Removing lines through symbols in legend in r

How can I remove the lines that intersect the symbols in an r legend? 如何删除与r图例中的符号相交的线? Have looked through ?legend but can't seem to find an answer.. 看过了?传说但似乎无法找到答案..

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)

在此输入图像描述

Just add lty=NULL 只需添加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)

EDIT 编辑

Deleting lwd=2 should suffice as pointed out by Josh O'Brien, so, your code should be: 删除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)

在此输入图像描述

You are only getting those lines because you specified lwd=2 , which tells the legend() function that you want "line width=2". 你只是得到那些行,因为你指定了lwd=2 ,它告诉你想要“line width = 2”的legend()函数。 If you don't want lines, just drop the lwd= argument. 如果你不想要行,只需删除lwd=参数即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM