Vin*_*nce 27
b0 = 2.5; b1 = 2
n = 100
x = rnorm(n, 20, 15)
y = b0 + b1*x + rnorm(n, 0, 15)
plot(x, y)
plot(x, y, type='n')
text(x, y, round(y, 2), cex=0.45)
text(x, y, round(y, 2), cex=0.8)
text(x, y, paste(round(x, 2), round(y, 2), sep=", "), cex=0.8) # for (x, y), but this gets cluttered.
Run Code Online (Sandbox Code Playgroud)

使用cex的字符大小(参见帮助文本).并且用于plot(x, y, type='n')正确设置窗口而不实际绘制任何内容.
用途text():
plot(1:10, 1:10)
text(5, 5, "Foo")
Run Code Online (Sandbox Code Playgroud)
并查看help(text)有关放置文本的选项.该函数是矢量化的,因此您也可以执行类似的操作
text(1:10, 1:10, LETTERS[1:10])
Run Code Online (Sandbox Code Playgroud)
如果你有文字和位置的向量.