[英]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.