R/smartColour.R

#' Smart Colour
#'
#' Assign colors to one dimensional value clusters
#'
#' @export
smartColour <- function(value, length=7, palette,idx=T){
  if(missing(palette)) palette <- colorRampPalette(c("#d8f5c5","#6ebe3b","#43821d"))

  if(min( value, na.rm=T ) == 0)
    c("#FFFFFF",palette(length-1))[smartCut(value, length, return='clust')] else
      palette(length)[smartCut(value, length, return='clust')]

}
elo2zero/oddsandsods documentation built on May 16, 2019, 3:04 a.m.