How can I remove the lines that intersect the symbols in an r legend? 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
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:
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". If you don't want lines, just drop the lwd=
argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With