Summary
I find that in some cases locations of labels seem to be displaced, as if some indexing is off by one. Until now, I have seen this only happening with labels bellow a line, but not above. Not with text_repel, but maybe just a question of available space.
Minimal code example
I will add a minimum example later today, but as you may be getting ready to submit the new version, this is shown as a warning of a proper example I will add by the end of the day.
This example demonstrates the issue, although it is not a minimum one.
library(ggplot2)
library(photobiology)
library(ggspectra)
ggplot(sun.spct) + geom_line() +
stat_label_valleys(geom = "label_repel", span = 51,
nudge_y = -0.075, segment.colour = "black",
colour = "black", fill = "white")
ggplot(sun.spct) + geom_line() +
stat_label_valleys(geom = "text_repel", span = 51,
nudge_y = -0.075, segment.colour = "black",
colour = "black")
Here is an image of the output produced by the code:


Suggestions
I have no proposal at the moment. This seems to be a bug.
Version information
Here is the output from sessionInfo() in my R session:
Session info -----------------------------------------------------------------------------------
setting value
version R version 3.4.3 Patched (2017-12-14 r73916)
system x86_64, mingw32
ui RStudio (1.1.399)
language (EN)
collate English_United Kingdom.1252
tz Europe/Helsinki
date 2017-12-18
Packages ---------------------------------------------------------------------------------------
package * version date source
base * 3.4.3 2017-12-15 local
colorspace 1.3-2 2016-12-14 CRAN (R 3.4.0)
compiler 3.4.3 2017-12-15 local
curl 3.1 2017-12-12 CRAN (R 3.4.3)
datasets * 3.4.3 2017-12-15 local
devtools * 1.13.4 2017-11-09 CRAN (R 3.4.2)
digest 0.6.13 2017-12-14 CRAN (R 3.4.3)
ggplot2 * 2.2.1.9000 2017-12-15 Github (tidyverse/ggplot2@bfff1d8)
ggrepel * 0.7.1 2017-12-16 Github (slowkow/ggrepel@3f5d03f)
ggspectra * 0.2.3 2017-12-16 local
git2r 0.19.0 2017-07-19 CRAN (R 3.4.1)
graphics * 3.4.3 2017-12-15 local
grDevices * 3.4.3 2017-12-15 local
grid 3.4.3 2017-12-15 local
gtable 0.2.0 2016-02-26 CRAN (R 3.4.0)
httr 1.3.1 2017-08-20 CRAN (R 3.4.1)
labeling 0.3 2014-08-23 CRAN (R 3.4.0)
lazyeval 0.2.1 2017-10-29 CRAN (R 3.4.2)
memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
methods * 3.4.3 2017-12-15 local
munsell 0.4.3 2016-02-13 CRAN (R 3.4.0)
photobiology * 0.9.18-1 2017-12-16 local
photobiologyWavebands 0.4.2 2017-03-20 CRAN (R 3.4.0)
plyr 1.8.4 2016-06-08 CRAN (R 3.4.0)
R6 2.2.2 2017-06-17 CRAN (R 3.4.0)
Rcpp 0.12.14 2017-11-23 CRAN (R 3.4.2)
rlang 0.1.4.9000 2017-12-16 Github (tidyverse/rlang@cc7587c)
rstudioapi 0.7 2017-09-07 CRAN (R 3.4.1)
scales 0.5.0.9000 2017-09-01 Github (hadley/scales@d767915)
splus2R 1.2-2 2016-09-02 CRAN (R 3.4.0)
stats * 3.4.3 2017-12-15 local
tibble 1.3.4 2017-08-22 CRAN (R 3.4.1)
tools 3.4.3 2017-12-15 local
utils * 3.4.3 2017-12-15 local
withr 2.1.0.9000 2017-11-25 Github (jimhester/withr@fe81c00)
yaml 2.1.16 2017-12-12 CRAN (R 3.4.3)
Summary
I find that in some cases locations of labels seem to be displaced, as if some indexing is off by one. Until now, I have seen this only happening with labels bellow a line, but not above. Not with text_repel, but maybe just a question of available space.
Minimal code example
I will add a minimum example later today, but as you may be getting ready to submit the new version, this is shown as a warning of a proper example I will add by the end of the day.
This example demonstrates the issue, although it is not a minimum one.
Here is an image of the output produced by the code:
Suggestions
I have no proposal at the moment. This seems to be a bug.
Version information
Here is the output from
sessionInfo()in my R session: