ggrepel is in CRAN

repel-peaks-exampleA new package has been accepted in CRAN. It was developed by Kamil Slowikowski and it defines two new geoms for ggplot2: geom_text_repel and geom_label_repel. These geoms work similarly to geom_text() and geom_label() but they “repel” (move) the text or labels so that they do not overlap and plot a segment joining the label or text to their true location. They work nicely with stat_peaks() and stat_valleys() from package ggspectra.

The pdf ggrepel-peaks-example looks better and really shows what can easily be achieved.

[code]
library(photobiology)
library(ggplot) # ver >= 2.0.0
library(ggspectra)
library(ggrepel)

ggplot(sun.spct) + geom_line() +
stat_peaks(span = 11, ignore_threshold = 0.1, pch = 21) +
stat_peaks(span = 11, ignore_threshold = 0.1, geom = “label_repel”,
color = “white”, size = rel(2.5), segment.color = “darkred”) +
scale_fill_identity()
[/code]

Preview

ggspectra 0.1.3 (4th preview: new package)

Added and renamed the “summary” statistics.

All plot() methods should function as in package photobiologygg except that as annotation() is not used at all and has been replaced by newly defined ggplot2 statistics all calculations are done per group and PANEL. Only some aesthetics may need to be tweaked when grouping is used.

User Guide includes code examples with explanations but some of the statistics added today lack examples.

Please, report any problems you encounter, and suggest possible changes or additions to the functionality!

NOTE: Sources, and Windows binaries for R 3.2.x, are now available in the R-test repository.