Closed
Description
Summary
I am using the latest development version of ggrepel because I need to justify multi-line label as discussed in
https://stackoverflow.com/questions/54448262/justifying-lines-of-text-within-individual-ggrepel-labels
But with that version's geom_label_repel, somehow the segment.color does not default to the same color as the text, as is not the case with the version on CRAN.
Minimal code example
Here I'm borrowing the example from
https://cran.r-project.org/web/packages/ggrepel/vignettes/ggrepel.html
#devtools::install_github("slowkow/ggrepel")
dat <- subset(mtcars, wt > 2.75 & wt < 3.45)
dat$car <- rownames(dat)
set.seed(42)
x_limits <- c(3, NA)
ggplot(dat, aes(wt, mpg, label = car, color = factor(cyl))) +
geom_vline(xintercept = x_limits, linetype = 3) +
geom_point() +
geom_label_repel(
arrow = arrow(length = unit(0.03, "npc"), type = "closed", ends = "first"),
force = 10,
xlim = x_limits
) +
scale_color_discrete(name = "cyl")
The colors of the segments are supposed to be green/red but they turn out to be black?
Version information
Here is the output from sessionInfo()
in my R session:
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)