R/plot.R

geom_tallrect <- function
### ggplot2 geom with xmin and xmax aesthetics that covers the entire
### y range.
(mapping=NULL,
 data=NULL,
 stat="identity",
 position="identity",
 ...){
  require(proto)
  require(ggplot2)
  GeomTallRect <- proto:::proto(ggplot2:::GeomRect,{
    objname <- "tallrect"
    required_aes <- c("xmin", "xmax")
    draw <- draw_groups <- function(.,data,scales,coordinates,
                                    ymin=0,ymax=1,...){
      ymin <- grid::unit(ymin,"npc")
      ymax <- grid::unit(ymax,"npc")
      with(ggplot2:::coord_transform(coordinates, data, scales),
           ggname(.$my_name(), {
        rectGrob(xmin, ymin, xmax - xmin, ymax-ymin,
                 default.units = "native", just = c("left", "bottom"), 
                 gp=gpar(
                   col=colour, fill=alpha(fill, alpha), 
                   lwd=size * .pt, lty=linetype, lineend="butt"
                   )
                 )
      }))
    }
  })
  GeomTallRect$new(mapping = mapping, data = data, stat = stat,
                   position = position, ...)
}

### Colors for plotting breakpoint annotations.
breakpoint.colors <- c("1breakpoint"="#ff7d7d","0breakpoints"="#f6f4bf")

### Colors for plotting piecewise constant signals and breakpoints.
signal.colors <- c(estimate="#0adb0a",latent="#0098ef")

Try the SegAnnot package in your browser

Any scripts or data that you put into this service are public.

SegAnnot documentation built on May 2, 2019, 5:22 p.m.