

if (FALSE)



  
gg_add_aes_to_plot <- function() {
  if (!is.null(color)) {
    P <- P + aes_string(color=color)
    ## Add a name for the legend
    if (is.null(names(color)))
      names(color) <- gg_cleanColumnName(color)
  }


  if (!is.null(dict.colors)) {
      if (is.null(color))
          stop ("cannot specifiy 'dict.colors' without specifying the 'color' column")
      ## TODO:  Check that  
      if (length(wh.colors.missing <- setdiff(unique(DT[[color]]), names(dict.colors)) ))
          warning (warningCols("There are unrepresented values for colors", wh.colors.missing))
      P <- P + scale_color_manual(values=dict.colors, name=names(color))
  } else if (!is.null(names(color))) {
      ## Different scaling function for discrete vs continuous column in DT
      if (is.numeric(DT[[color]]))
        P <- P + scale_color_continuous(name=names(color))
      else 
        P <- P + scale_color_discrete(name=names(color))
  }

}