colorRampPalette         package:geneplotter         R Documentation

_E_x_t_e_n_d _a _c_o_l_o_r _p_a_l_e_t_t_e _t_o _a _c_o_l_o_r _r_a_m_p

_D_e_s_c_r_i_p_t_i_o_n:

     These functions are useful for converting hand-designed
     `sequential' or `diverging' color schemes into continous color
     ramps eg for image and filled contour plots.

_U_s_a_g_e:

     colorRampPalette(palette, bias = 1,method=c("linear","spline"))
     colorRamp(palette, bias=1,method=c("spline","linear"))

_A_r_g_u_m_e_n_t_s:

 palette: A vector of colors

    bias: Bias >1 puts more colors at high values, <1 puts more at low
          values

  method: Interpolation method. Spline interpolation may give smoother
          results but can end up outside the valid RGB space,
          especially with highly saturated palettes or those based on a
          small starting set.

_V_a_l_u_e:

     'colorRampPalette' returns a palette generating function like
     'terrain.colors' or 'heat.colors' that takes an integer argument
     and generates a palette with that many colors.

     'colorRamp' returns a color generating function, that takes a
     number between 0 and 1 and generates the corresponding color.

_A_u_t_h_o_r(_s):

     Thomas Lumley

_S_e_e _A_l_s_o:

     <URL: www.colorbrewer.org>

_E_x_a_m_p_l_e_s:

        m<-outer(1:20,1:20,function(x,y) sin(sqrt(x*y)/3))

        redblue<-colorRampPalette(c("red","orange","blue"))
        filled.contour(m,color.palette=redblue)

        yb<-colorRampPalette(c("yellow2","goldenrod","darkred"))
        filled.contour(m,color.palette=yb)

        yb<-colorRampPalette(c("yellow2","goldenrod","darkred"),bias=0.5)
        filled.contour(m,color.palette=yb)

        ## Two ColorBrewer sequential palettes
        ylOrBn4<-c("#FFFFD4", "#FED98E", "#FE9929","#CC4C02")
        ylGnBl5<-c("#FFFFCC","#C7E9B4","#7FCDBB","#40B6C4","#2C7FB8" ,"#253494")

        ylOrBn<-colorRampPalette(ylOrBn4)
        ylGnBl<-colorRampPalette(ylGnBl5,method="spline")
        filled.contour(m,color.palette=ylOrBn)
        filled.contour(m,color.palette=ylGnBl)

        if(require("RColorBrewer")){
             RdBu7<-colorRampPalette(brewer.pal(7,"RdBu"),method="spline")
             RWB<-colorRampPalette(c("red","white","blue"))
             redblue<-colorRampPalette(c("red","blue"))
             filled.contour(m,color.palette=redblue,main="naive red-blue")
             filled.contour(m,color.palette=RWB,main="naive red-white-blue")
             filled.contour(m,color.palette=RdBu7,main="ColorBrewer RdBu7")
        }

