Add pch symbol in R plot legend

前端 未结 1 617
感动是毒
感动是毒 2021-02-07 03:04

I have one time series which is represented by a black line and one which is represented by a red curve. Then I have single points which have the pch symbol of 8 in R. These are

相关标签:
1条回答
  • 2021-02-07 03:44

    Try this. You set lty to display only first two lines, and pch to display only the last point.

    plot(1:10, rnorm(10) * 1:10)
    legend("bottomleft", legend = c("entry1", "entry2", "something cpl different"), bty = "n",
           lwd = 2, cex = 1.2, col = c("black", "blue", "red"), lty = c(1, 1, NA), pch = c(NA, NA, 8))
    

    enter image description here

    0 讨论(0)
提交回复
热议问题