立即學習:https://edu.csdn.net/course/play/24913/285853?utm_source=blogtoedu
text函數
text(x,y,labels,…)
x,y是資料向量
labels可以是整數,也可以是字元串,預設狀态下,labels=1:length(x)
x <- 1:20
y <- sample(1:100, 20)
plot(x, y, type = "n")
text(x, y)
對應結果:
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIyZuBnLzEDNyUTM5ETMwcTM2ADMyAjMvwlbj5yZtlmbkN3YuM3ci1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
plot(1:5, 1:5)
text(x = c(3, 3), y = c(3, 5))
對應結果:
plot(1:5, 1:5)
text(x = c(3, 3), y = c(3, 5), labels = c("a", "b"), col = c("red", "blue"))
對應結果: