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]

ggplot2 2.0.0 has been released

Warning!

Package photobiologygg is NOT compatible with the just released new version of package ggplot2. I knew this was coming but I will still need some days before getting my own package updated. I had used unexported functions, and of course this was dangerous. The good news is that the improvements in ggplot will allow me to implement the same functionality without need for the “illegal tricks” I had earlier used.

Sorry about my delay with this! If you use photobiologygg please, wait a few days before updating ggplot2.