getColorMap.ggobi           package:Rggobi           R Documentation

_S_e_t _o_r _q_u_e_r_y _t_h_e _c_o_l_o_r_m_a_p _f_o_r _a _g_g_o_b_i _i_n_s_t_a_n_c_e.

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

     These functions allow one to retrieve or set the contents of the
     color map used by a ggobi instance. The color map is an $n \times
     3$ matrix of of which each row contains the  Red, Green and Blue
     values defining a color. Some colors have names and others are
     referenced simply by index in the colormap.

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

     getColorMap.ggobi(.gobi=getDefaultGGobi())
     setColorMap.ggobi(vals, .gobi=getDefaultGGobi(), scale = 65535)

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

    vals: an $n$ by $3$ matrix giving the entries in the colormap in
          terms of their Red, Green and Blue components. The columns of
          the matrix should be in that order.

   .gobi: an identifier for the ggobi instance whose color map is to be
          set or retrieved. This is either an integer or an object of
          class 'ggobi'.

   scale: a scaling factor by which the elements of the matrix are
          multiplied to convert them to internal format for use with
          Gtk.

_D_e_t_a_i_l_s:

     These functions convert the internal representation in ggobi of a
     colormap to an R matrix and vice-versa.

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

     'getColorMap.ggobi' returns a matrix of  dimension $n \times 3$
     containing the Red, Green and Blue values with each element being
     between  $0$ and $1$. The row names are those stored in the ggobi
     colormap, if supplied when reading the color map, or otherwise the
     index (starting at $1$).

     'setColorMap'

_N_o_t_e:

     Currently, when operating on the colormap, one must operate on all
     of it, rather than operating on individual elements.  In other
     words, one has to copy it all into R, modify the values and then
     transfer it back to ggobi.  Since colormaps are reasonably small,
     can be specified in files and change infrequently, this is not a
     large penalty.

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

     Duncan Temple Lang

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.ggobi.org/RSggobi.html>

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

     'getColors.ggobi' 'setColors.ggobi'

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

       g <- ggobi(system.file("data", "flea.xml", package="Rggobi"), args="-noinit")
       g$getColorMap()
       names(g$getColorMap())
       
         # register a new color map with only 3 entries - Red, Green and Blue.
         # Then convert the colors' of the points to these values.
       cm <- diag(3)
       rownames(cm) <- c("R", "G","B")
       g$setColorMap(cm)

     ## Not run: 
       m["green", 1] <- .5
       g$setColorMap(m)
       g$setColors(rep("green", 20))
     ## End(Not run)

     ## Not run: 
       # Copy a colormap from one ggobi to another
      g1 <- ggobi(system.file("data", "flea.xml", package="Rggobi"), args="-noinit")
      g2 <- ggobi(system.file("data", "sat.xml", package="Rggobi"), args="-noinit")
      g2$setColorMap(g1$getColorMap())
     ## End(Not run)

