2014-10-04 35 views
0

有沒有一種方法可以將數據框的列的內容作爲標籤顯示在圖上?這裏的東西就像我從網上拉出來的圖片。如果我在列中的點旁邊有數字,我該如何讓它們出現在劇情中? 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

回答

0

作爲答案發帖。如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") 
相關問題