在R中的图例中删除符号中的线

标签 r plot legend

如何删除与r图例中的符号相交的线?查阅了?legend,但似乎找不到答案。

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

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)

关于在R中的图例中删除符号中的线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12496093/

相关文章:

r - R 中的圆形堆积条形图

r - 如何在 R> 中使用双 y 轴将图例添加到 ggplot

r - ggplot 扩展图例颜色条

perl - Gdata包perl问题

r - 如何进行不区分大小写的搜索?

r - 生成堆积条形图

python - 带有空标记的 Matplotlib 绘图线

r - 热图中 z 分数和相应 p 值的共享图例

python - R 和 python 之间的数据交换 (music21)

r - 为什么我的 3D 绘图没有显示在 R Studio 绘图查看器中?