[英]R - How can I color and label the max and min values points of my scatterplot using ggplot2?
[英]How to cleanly label the points in a simple ggplot2 scatterplot?
請參閱http://had.co.nz/ggplot2/geom_text.html中的示例; 他們非常可怕。 標簽相互重疊,運行在 plot 等之外。
我認為directlabels可能會有所幫助,但實際上並沒有:
direct.label(qplot(wt,mpg,data=mtcars,colour=rownames(mtcars)))
手動定位每個 label 很繁瑣。 希望有一些東西可以使標簽更有用。 有什么可能符合要求的嗎?
希望答案還為時不晚。 我現在不關心 ggplot2,我使用 plot() 使用普通散點圖。 我嘗試了許多標簽算法,最好的是 package maptools 中的 pointLabel() 用空格包裝標簽:-)
pointLabel(x, y, labels = paste(" ", point_names, " ", sep="")
我嘗試了 package plotrix 中的 thigmophobe.labels(),package 中的 textxy() 校准或標准 text(),但我認為 pointLabel() 是最好的。
但無論如何,出於我的目的,我最終只是簡單地使用了 identify() 並且我只是單擊了我想要 label 的點 - 非常有用,你只需單擊異常值和一些有趣的點就可以了!
托馬斯
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.