ColorBar                package:GLAD                R Documentation

_C_a_l_i_b_r_a_t_i_o_n _b_a_r _f_o_r _c_o_l_o_r _i_m_a_g_e_s

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

     This function produces a color image (color bar) which can be used
     for the legend to another color image obtained from the functions
     'image' or 'arrayPlot'.

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

     ColorBar(x, horizontal=TRUE, col=heat.colors(50), scale=1:length(x), k=10, ...)

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

       x: If "numeric", a vector containing the "z" values in the color
          image, i.e., the values which are represented in the color
          image. Otherwise, a "character" vector representing colors.

horizontal: If 'TRUE', the values of 'x' are represented as vertical
          color strips in the image, else, the values are represented
          as horizontal color strips.

     col: Vector of colors such as that generated by rainbow,
          heat.colors, topo.colors, terrain.colors, or similar
          functions. In addition to these color palette functions, a
          new function  'myPalette' was defined to generate color
          palettes from user supplied low, middle, and high color
          values.

   scale: A "numeric" vector specifying the "z" values in the color
          image. This is used when the argument 'x' is a "character"
          vector representing color information.

       k: Object of class "numeric", for the number of labels displayed
          on the bar.

     ...: Optional graphical parameters, see 'par'.

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

     Sandrine Dudoit, Yee Hwa (Jean) Yang.

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

     'image', 'arrayPlot' 'myPalette'.

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

     par(mfrow=c(3,1))
     Rcol <- myPalette(low="white", high="red", k=10)
     Gcol <- myPalette(low="white", high="green", k=50)
     RGcol <- myPalette(low="green", high="red", k=100)
     ColorBar(Rcol)
     ColorBar(Gcol, scale=c(-5,5))
     ColorBar(1:50, col=RGcol)

     par(mfrow=c(1,3))
     x<-seq(-1, 1, by=0.01)
     ColorBar(x, col=Gcol, horizontal=FALSE, k=11)
     ColorBar(x, col=Gcol, horizontal=FALSE, k=21)
     ColorBar(x, col=Gcol, horizontal=FALSE, k=51)

