heatmap_2              package:Heatplus              R Documentation

_D_i_s_p_l_a_y _D_a_t_a _a_s _H_e_a_t_m_a_p

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

     This function displays an expression data matrix as a heatmap. It
     is based on an old version of 'heatmap' in the 'stats' package,
     but offers more flexibility (e.g. skipping dendrograms, skipping
     row/column labelling, adding a legend).

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

     heatmap_2(x, Rowv, Colv, distfun = dist, hclustfun = hclust, add.expr, 
               scale = c("row", "column", "none"), na.rm = TRUE, 
                       do.dendro = c(TRUE, TRUE), legend = 0, legfrac = 8, 
                       col = heat.colors(12), trim, ...)

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

       x: the numerical data matrix to be displayed.

    Rowv: either a dendrogram or a vector of reordering indexes for the
          rows.

    Colv: either a dendrogram or a vector of reordering indexes for the
          columns.

 distfun: function to compute the distances between rows and columns. 
          Defaults to 'dist'.

hclustfun: function used to cluster rows and columns. Defaults to
          'hclust'.

add.expr: Expression to be evaluated after the call to 'image'. See
          Details.

   scale: indicates whether values should be scaled by either by row,
          column, or not at all. Defaults to 'row'.

   na.rm: logical indicating whther to remove NAs.

do.dendro: logical vector of length two, indicating (in this order)
          whether to draw the row and column dendrograms.

  legend: integer between 1 and 4, indicating on which side of the plot
          the legend should be drawn, as in 'mtext'.

 legfrac: fraction of the plot that is taken up by the legend; larger
          values correspond to smaller legends.

     col: the color scheme for 'image'. The default sucks.

    trim: Percentage of values to be trimmed. This helps to keep an
          informative color scale, see Details.

     ...: extra arguments to 'image'.

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

     With all parameters at their default, this gives the same result
     as a very old  version of 'heatmap' that was the base for the
     modifications. All parameters of the same name have the same
     function as in 'heatmap', though 'add.expr', which can be used for
     adding graphical elements after the call to 'image', will probably
     not produce useful results. Note also that row- and column labels
     are optional, i.e. if the corresponding 'dimname' of 'x' is
     'NULL', no labels are displayed.

     Setting 'trim' to a number between 0 and 1 uses equidistant
     classes between the ('trim')- and (1-'trim')-quantile, and lumps
     the values below and above this range into separate open-ended
     classes. If the data comes from a  heavy-tailed distribution, this
     can save the display from putting too many values into to few
     classes.

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

     Same as 'heatmap' with 'keep.dendro=FALSE': an invisible list
     giving the reordered indices of the row- and column-elements as
     elements 'rowInd' and 'colInd'.

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

     Original by Andy Liaw, with revisions by Robert Gentleman and
     Martin Maechler.

     Alexander Ploner for this version.

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

     'heatmap', 'hclust', 'heatmap_plus'

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

     # create data
     mm = matrix(rnorm(1000, m=1), 100,10)
     mm = cbind(mm, matrix(rnorm(2000), 100, 20))
     mm = cbind(mm, matrix(rnorm(1500, m=-1), 100, 15))
     mm2 = matrix(rnorm(450), 30, 15)
     mm2 = cbind(mm2, matrix(rnorm(900,m=1.5), 30,30))
     mm=rbind(mm, mm2)
     colnames(mm) = paste("Sample", 1:45)
     rownames(mm) = paste("Gene", 1:130)

     # similar to base heatmap
     heatmap_2(mm)

     # remove column dendrogram
     heatmap_2(mm, do.dendro=c(TRUE, FALSE))

     # add a legend under the plot
     heatmap_2(mm, legend=1)
     # make it smaller
     heatmap_2(mm, legend=1, legfrac=10)
     # ... on the left side
     heatmap_2(mm, legend=2, legfrac=10)

     # remove the column labels by removing the column names
     colnames(mm)=NULL
     heatmap_2(mm, legend=1, legfrac=10)

     # truncate the data drastically
     heatmap_2(mm, legend=1, legfrac=10, trim=0.1)

