I am using the geom_label_repel
function to arrange labels in a way that avoids overlapping but when I add an regression line to my plot, then it itself overlaps the labels.
ggplot(globalMetrics, aes(x=globalMetrics$popDensity, y=globalMetrics$turnover)) + geom_point() +
theme_bw() + geom_label_repel(aes(label= rownames(globalMetrics)), size=3) + stat_smooth(method="lm")
Is there a way to avoid this in ggplot
?
Here is a sample of the data:
dput(globalMetrics)
structure(list(popDensity = c(4308, 27812, 4447, 5334, 4662,
2890), turnover = c(2.65, 4.49, 2.37, 2.87, 3.87, 2.95)), .Names = c("popDensity",
"turnover"), row.names = c("label1", "label2", "label3", "label4",
"label5", "label6"), class = "data.frame")