【发布时间】:2014-10-04 10:13:49
【问题描述】:
有没有办法将数据框列的内容作为标签显示在图上?像我从网上提取的这张图片。如果我在一列中的点旁边有数字,我怎样才能让它们出现在图中?
【问题讨论】:
-
看看
?text -
是的,
text()和row.names(),请查看 statmethods.net/advgraphs/axes.html
有没有办法将数据框列的内容作为标签显示在图上?像我从网上提取的这张图片。如果我在一列中的点旁边有数字,我怎样才能让它们出现在图中?
【问题讨论】:
?text
text() 和 row.names(),请查看 statmethods.net/advgraphs/axes.html
作为答案发布。使用 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")
【讨论】: