使用R中的识别功能

use*_*686 3 label r scatter-plot

在散点图中,我想使用identify函数来标记正确的顶点.

我这样做了:

identify(x, y, labels=name, plot=TRUE)
Run Code Online (Sandbox Code Playgroud)

*我有一个命名向量.

然后,当它运行时,我指向正确的点.然后在停止后,它会显示该点的标签.

我是否必须每次点击我想要标记的点?我可以保存吗?

mar*_*bel 7

# Here is an example

x = 1:10
y = x^2

name = letters[1:10]    
plot(x, y)

identify(x, y, labels = name, plot=TRUE)

# Now you have to click on the points and select finish at the end
# The output will be the labels you have corresponding to the dots.
Run Code Online (Sandbox Code Playgroud)

关于保存它:我无法使用它

pdf() 
# plotting code
dev.off()
Run Code Online (Sandbox Code Playgroud)

但是在Rstudio中,它可以"复制粘贴"它.如果你只需要一个情节,我想这会奏效.