将行内容作为标签包含在R图中

问题描述:

有没有一种方法可以将数据框的列的内容作为标签显示在图上?这里的东西就像我从网上拉出来的图片。如果我在列中的点旁边有数字,我该如何让它们出现在剧情中? enter image description here将行内容作为标签包含在R图中

+1

如下看看'?text' – jbaums 2014-10-04 10:15:10

+0

是的,'文本()'和'row.names()',检查出http://www.statmethods.net/advgraphs /axes.html – 2014-10-04 10:18:23

作为答案发帖。如jbaums所述,使用text()。这个例子直接从http://www.statmethods.net/advgraphs/axes.html

attach(mtcars) 
plot(wt, mpg, main="Milage vs. Car Weight", 
    xlab="Weight", ylab="Mileage", pch=18, col="blue") 
text(wt, mpg, row.names(mtcars), cex=0.6, pos=4, col="red")