gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 18:11:39 27 4
gpt4 key购买 nike

如何删除与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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com