ggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements.
Source:R/z_geoms.R
      geom_tallrect.Rdggplot2 geom with xmin and xmax aesthetics that covers the entire y range, useful for clickSelects background elements.
Usage
geom_tallrect(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  ...,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE
)Examples
if(require('data.table'))setDTthreads(1)#for CRAN.
library(animint2)
## Example: 2 plots, 2 selectors, but only interacting with 1 plot.
data(breakpoints)
only.error <- subset(breakpoints$error,type=="E")
only.segments <- subset(only.error,bases.per.probe==bases.per.probe[1])
signal.colors <- c(estimate="#0adb0a", latent="#0098ef")
breakpointError <- list(
  signal=ggplot()+
    geom_point(aes(
      position, signal),
      showSelected="bases.per.probe",
      data=breakpoints$signals)+
    geom_line(aes(
      position, signal), 
      colour=signal.colors[["latent"]],
      data=breakpoints$imprecision)+
    geom_segment(aes(
      first.base, mean, xend=last.base, yend=mean),
      showSelected=c("segments", "bases.per.probe"),
      colour=signal.colors[["estimate"]],
      data=breakpoints$segments)+
    geom_vline(aes(
      xintercept=base),
      showSelected=c("segments", "bases.per.probe"),
      colour=signal.colors[["estimate"]],
      linetype="dashed",
      data=breakpoints$breaks),
  error=ggplot()+
    geom_vline(aes(
      xintercept=segments), 
      clickSelects="segments",
      data=only.segments, lwd=17, alpha=1/2)+
    geom_line(aes(
      segments, error, group=bases.per.probe),
      clickSelects="bases.per.probe",
      data=only.error, lwd=4))
animint2dir(breakpointError)