I have a plot as below
You can reproduce the graph using this code:
set.seed(42)
d <- data.frame(
x1 = 1,
y1 = rnorm(10),
x2 = 2,
y2 = rnorm(10),
lab = state.name[1:10]
)
p <- ggplot(d, aes(x1, y1, xend = x2, yend = y2, label = lab, col = lab)) +
geom_segment(size = 1) +
guides(color = "none") +
theme(axis.title.x = element_blank()) +
geom_text_repel(
nudge_x = -0.2, direction = "y", hjust = "right"
) +
geom_text_repel(
aes(x2, y2), nudge_x = 0.1, direction = "y", hjust = "left"
)
p
The graph is a bit of a muddle, so I want to remove all the labels on the left hand side, leave only the labels on the right hand side. Like this
What should I add into the geom_label_repel()
to do that?