How do I left justify my label using geom_text_repel
? In the example below, I would like the word "very" to be underneath the word "this". Here I use the left justify setting i.e., hjust = 0
library(tidyverse)
library(ggrepel)
mtcars %>%
ggplot(aes(hp, drat, label = "this label is so long \n very long \n very long")) +
geom_line() +
geom_text_repel(data = mtcars %>%
filter(hp == max(hp)),
nudge_x = 0.4,
segment.color = 'transparent',
size = 3,
force =0.2,
hjust = 0)
I may need to approach this problem using annotate
instead of ggrepel
see - Justifying lines of text within individual ggrepel labels , but ggrepel
would be preferable
Another option may be to use grid::grid.gedit
, but I don't understand how to apply this framework to ggrepel
see - ggplot2: How to left-justify text from multi-line facet labels?
Edit: The problem in this question is similar to Override horizontal positioning with ggrepel , but the questions differ in that here I use hjust = 0
, whereas the other question uses hjust = "outward"