天天看點

學習筆記(109):R語言入門基礎-text函數

立即學習: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)
           

對應結果:

學習筆記(109):R語言入門基礎-text函數
plot(1:5, 1:5)
text(x = c(3, 3), y = c(3, 5))
           

 對應結果:

學習筆記(109):R語言入門基礎-text函數
plot(1:5, 1:5)
text(x = c(3, 3), y = c(3, 5), labels = c("a", "b"), col = c("red", "blue"))
           

 對應結果:

學習筆記(109):R語言入門基礎-text函數

繼續閱讀