Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The latest development version's segment.color does not default to the same color as the text? #164

Closed
lishinkou opened this issue Jun 17, 2020 · 2 comments
Labels

Comments

@lishinkou
Copy link

lishinkou commented Jun 17, 2020

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?

example

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)
@lishinkou lishinkou changed the title The latest development version's segment.color is not defaults to the same color as the text? The latest development version's segment.color does not default to the same color as the text? Jun 17, 2020
@slowkow slowkow added the bug label Jun 17, 2020
@slowkow
Copy link
Owner

slowkow commented Jun 17, 2020

Thanks for the opening the issue and including an example with code and image.

Please share the entire output from sessionInfo(), so we can see the versions of your packages.

@lishinkou
Copy link
Author

lishinkou commented Jun 18, 2020

Here it is:

R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    
system code page: 932

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggrepel_0.9.0 ggplot2_3.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6     rstudioapi_0.11  magrittr_1.5     tidyselect_1.1.0
 [5] munsell_0.5.0    colorspace_1.4-1 R6_2.4.1         rlang_0.4.6     
 [9] dplyr_0.8.5      tools_4.0.0      grid_4.0.0       gtable_0.3.0    
[13] withr_2.2.0      ellipsis_0.3.1   assertthat_0.2.1 digest_0.6.25   
[17] tibble_3.0.1     lifecycle_0.2.0  crayon_1.3.4     purrr_0.3.4     
[21] farver_2.0.3     vctrs_0.3.1      glue_1.4.1       labeling_0.3    
[25] compiler_4.0.0   pillar_1.4.4     scales_1.1.1     pkgconfig_2.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants