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 )

