【问题标题】:Include row contents as labels in R plot将行内容作为标签包含在 R 图中
【发布时间】:2014-10-04 10:13:49
【问题描述】:

有没有办法将数据框列的内容作为标签显示在图上?像我从网上提取的这张图片。如果我在一列中的点旁边有数字,我怎样才能让它们出现在图中?

【问题讨论】:

标签: r plot label


【解决方案1】:

作为答案发布。使用 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")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-07
    • 2021-12-05
    • 1970-01-01
    • 2012-09-07
    • 1970-01-01
    • 1970-01-01
    • 2014-02-07
    • 1970-01-01
    相关资源
    最近更新 更多