hilbertDefaultPalette       package:HilbertVis       R Documentation

_D_e_f_a_u_l_t _p_a_l_e_t_t_e _f_o_r _H_i_l_b_e_r_t _c_u_r_v_e _v_i_s_u_a_l_i_z_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Calculates a colour palette of length 'size'. This palette is used
      as default by 'hilbertDisplay' (in the "HilbertVisGUI" package)
     and also  useful for 'hilbertImage' (see example there).

_U_s_a_g_e:

     hilbertDefaultPalette( size, asArray=TRUE )

_A_r_g_u_m_e_n_t_s:

    size: The number of desired colours.

 asArray: Whether to return an array of RGB values or a character
          vector of color specs.

_V_a_l_u_e:

     * if 'asArray=TRUE' (default): An array with 3 rows and 'size'
     columns, containing RGB values. This is the same format as
     returned by 'col2rgb'.

     * if 'asArray=FALSE': A character vector of color specs, suitable
     to be passed to the 'col' argument of 'plot'.

_A_u_t_h_o_r(_s):

     Simon Anders, EMBL-EBI, sanders@fs.tum.de

_E_x_a_m_p_l_e_s:

     # Get a palette
     palette <- hilbertDefaultPalette(30)
     # Transform from RGB triples to color strings (i.e., do the 
     # reverse of col2rgb)
     colors <- apply( palette, 2, function(a) rgb(a[1], a[2], a[3], max=255) )
     # Plot the palette
     plot.new()
     plot.window( xlim=c(.5,30.5), ylim=c(0,1) )
     rect( 1:30-.5, 0, 1:30+.5, 1, col=colors )

