According to the most recent updates, ggrepel
now supports hjust
and vjust
. According to the documentation, using this should align all of the labels. However, I'm unable to get the labels to align, as seen below
I have tried
library(tidyverse)
library(ggrepel)
df <- data.frame(x=seq(1:5), y=seq(1:5), label=letters[seq(1:5)])
ggplot(df, aes(x=x, y=y)) +
geom_point() +
geom_text_repel(aes(label=label),
force=1, point.padding=unit(1,'lines'),
hjust=0,
direction='y',
nudge_x=0.1,
segment.size=0.2) +
geom_smooth(method='lm')
How can I align these labels?
EDIT
I should add that it's not just having the labels aligned, but also having them near each other, with different length connectors in order to facilitate that.