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("linear","spline"))

_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")
        }

