找回密码
 注册
查看: 13497|回复: 0

R语言:heatmap()函数中文帮助文档(中英文对照)

  [复制链接]
发表于 2012-2-17 10:25:22 | 显示全部楼层 |阅读模式
heatmap(stats)
heatmap()所属R语言包:stats

                                         Draw a Heat Map
                                         绘制热图

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

A heat map is a false color image (basically image(t(x))) with a dendrogram added to the left side and to the top.  Typically, reordering of the rows and columns according to some set of values (row or column means) within the restrictions imposed by the dendrogram is carried out.
热图是一个虚假的彩色图像(基本上image(t(x)))与树状添加到左侧和顶端。通常情况下,根据树状图所施加的限制范围内的值(行或列方式)一些行和列重新排序开展。


用法----------Usage----------


heatmap(x, Rowv=NULL, Colv=if(symm)"Rowv" else NULL,
        distfun = dist, hclustfun = hclust,
        reorderfun = function(d,w) reorder(d,w),
        add.expr, symm = FALSE, revC = identical(Colv, "Rowv"),
        scale=c("row", "column", "none"), na.rm = TRUE,
        margins = c(5, 5), ColSideColors, RowSideColors,
        cexRow = 0.2 + 1/log10(nr), cexCol = 0.2 + 1/log10(nc),
        labRow = NULL, labCol = NULL, main = NULL,
        xlab = NULL, ylab = NULL,
        keep.dendro = FALSE, verbose = getOption("verbose"), ...)



参数----------Arguments----------

参数:x
numeric matrix of the values to be plotted.  
要绘制的值的数字矩阵。


参数:Rowv
determines if and how the row dendrogram should be computed and reordered.  Either a dendrogram or a vector of values used to reorder the row dendrogram or NA to suppress any row dendrogram (and reordering) or by default, NULL, see "Details" below.
决定是否和如何计算和重新排列行聚类分析应。无论是dendrogram或用来重新排列行树状或值的向量NA镇压任何行聚类分析和重新排序或默认情况下,NULL,请参阅下面的“详细资料”。


参数:Colv
determines if and how the column dendrogram should be reordered.  Has the same options as the Rowv argument above and additionally when x is a square matrix, Colv =       "Rowv" means that columns should be treated identically to the rows (and so if there is to be no row dendrogram there will not be a column one either).
决定是否以及如何重新排序列树状应。有Rowv上述论点,另外,当x是一个方阵,Colv =       "Rowv"列应相同对待行(所以如果有是没有相同的选项行聚类分析,将不会是一个1或者列)。


参数:distfun
function used to compute the distance (dissimilarity) between both rows and columns.  Defaults to dist.
函数用于计算行和列之间的距离(相异)。 dist默认。


参数:hclustfun
function used to compute the hierarchical clustering when Rowv or Colv are not dendrograms.  Defaults to hclust. Should take as argument a result of distfun and return an object to which as.dendrogram can be applied.
函数用于计算的层次聚类Rowv或Colv不聚类。 hclust默认。应采取作为参数的distfunas.dendrogram可用于返回一个对象。


参数:reorderfun
function(d,w) of dendrogram and weights for reordering the row and column dendrograms.  The default uses reorder.dendrogram.
(D,W)重新排序的行和列聚类的聚类分析和重量的功能。默认使用reorder.dendrogram。


参数:add.expr
expression that will be evaluated after the call to image.  Can be used to add components to the plot.
表达式将调用image后评估。可用于将组件添加到图。


参数:symm
logical indicating if x should be treated symmetrically; can only be true when x is a square matrix.
逻辑表明,如果x应该被视为对称,只能是真实的时x是一个方阵。


参数:revC
logical indicating if the column order should be reversed for plotting, such that e.g., for the symmetric case, the symmetry axis is as usual.
逻辑表明,如果列的顺序应该是reversed的图,这样,例如,为对称的情况下,对称轴是像往常一样。


参数:scale
character indicating if the values should be centered and scaled in either the row direction or the column direction, or none.  The default is "row" if symm false, and "none" otherwise.
如果值应行的方向或列方向,或无为本,缩放字符显示。默认是"row"如果symm假的,"none"否则。


参数:na.rm
logical indicating whether NA's should be removed.
逻辑表明NA的是否应该被删除。


参数:margins
numeric vector of length 2 containing the margins (see par(mar= *)) for column and row names, respectively.
数字矢量包含利润(见par(mar= *))分别列名和列名,长度为2。


参数:ColSideColors
(optional) character vector of length ncol(x) containing the color names for a horizontal side bar that may be used to annotate the columns of x.
(可选)长度的字符向量ncol(x)水平的侧栏,可用于注释x列包含的颜色名称。


参数:RowSideColors
(optional) character vector of length nrow(x) containing the color names for a vertical side bar that may be used to annotate the rows of x.
(可选)长度的字符向量nrow(x)包含可以用来注释x行垂直侧栏的颜色名称。


参数:cexRow, cexCol
positive numbers, used as cex.axis in for the row or column axis labeling.  The defaults currently only use number of rows or columns, respectively.
正数,行或列轴标签使用cex.axis。目前默认只使用行或列数,分别。


参数:labRow, labCol
character vectors with row and column labels to use; these default to rownames(x) or colnames(x), respectively.
行和列标签使用的特征向量;这些rownames(x)或colnames(x),分别默认。


参数:main, xlab, ylab
main, x- and y-axis titles; defaults to none.
主,X和Y轴的标题;默认为none。


参数:keep.dendro
logical indicating if the dendrogram(s) should be kept as part of the result (when Rowv and/or Colv are not NA).
逻辑时表示,如果树状图(S)应保持作为结果的一部分(Rowv和/或Colv不适用)。


参数:verbose
logical indicating if information should be printed.
逻辑说明是否应印信息。


参数:...
additional arguments passed on to image, e.g., col specifying the colors.  </table>
额外的参数传递给image,例如,col指定的颜色。 </ TABLE>


Details

详情----------Details----------

If either Rowv or Colv are dendrograms they are honored (and not reordered).  Otherwise, dendrograms are computed as dd <- as.dendrogram(hclustfun(distfun(X))) where X is either x or t(x).
如果任Rowv或Colv他们很荣幸(而不是重新排序)聚类。否则,聚类计算dd <- as.dendrogram(hclustfun(distfun(X)))X或者x或t(x)。

If either is a vector (of "weights") then the appropriate dendrogram is reordered according to the supplied values subject to the constraints imposed by the dendrogram, by reorder(dd,     Rowv), in the row case. If either is missing, as by default, then the ordering of the corresponding dendrogram is by the mean value of the rows/columns, i.e., in the case of rows, Rowv <- rowMeans(x, na.rm=na.rm). If either is NA, no reordering will be done for the corresponding side.
要么是一个向量(“重量”),然后适当的聚类被重新排序reorder(dd,     Rowv)根据所提供的值树状图的限制,在该行的情况。默认情况下,如果任一缺失,那么相应的聚类顺序是平均值的行/列,即行的情况下,Rowv <- rowMeans(x, na.rm=na.rm)。如果其中一个是NA,无重排将做相应的侧面。

By default (scale = "row") the rows are scaled to have mean zero and standard deviation one.  There is some empirical evidence from genomic plotting that this is useful.
默认情况下(scale = "row")行缩放,平均为零,标准偏差一。有一些基因组绘图,这是非常有用的经验证据。

The default colors are not pretty.  Consider using enhancements such as the RColorBrewer package, http://cran.r-project.org/package=RColorBrewer.
默认的颜色是不漂亮。考虑使用RColorBrewer包,http://cran.r-project.org/package=RColorBrewer如增强。


值----------Value----------

Invisibly, a list with components
无形之中,一个组件的列表


参数:rowInd
row index permutation vector as returned by order.dendrogram.
行指数排列向量order.dendrogram返回。


参数:colInd
column index permutation vector.
列指标排列向量。


参数:Rowv
the row dendrogram; only if input Rowv was not NA and keep.dendro is true.
行聚类分析;只要输入RowvNA和keep.dendro是真实的。


参数:Colv
the column dendrogram; only if input Colv was not NA and keep.dendro is true.
列树状图;只要输入ColvNA和keep.dendro是真实的。


注意----------Note----------

Unless Rowv = NA (or Colw = NA), the original rows and columns are reordered in any case to match the dendrogram, e.g., the rows by order.dendrogram(Rowv) where Rowv is the (possibly reorder()ed) row dendrogram.
除非Rowv = NA(Colw = NA),原来的行和列重新排序,在任何情况下匹配order.dendrogram(Rowv)其中Rowv(可能的聚类分析,例如,行reorder()ED)行聚类分析。

heatmap() uses layout and draws the image in the lower right corner of a 2x2 layout. Consequentially, it can not be used in a multi column/row layout, i.e., when par(mfrow= *) or (mfcol= *) has been called.
heatmap()使用layout“绘制在一个2x2布局右下角的image。作出相应,它不能被用来在一个多列/行的布局,即,当par(mfrow= *)或(mfcol= *)已被称为。


作者(S)----------Author(s)----------


Andy Liaw, original; R. Gentleman, M. Maechler, W. Huber, revisions.



参见----------See Also----------

image, hclust
image,hclust


举例----------Examples----------


require(graphics); require(grDevices)
x  <- as.matrix(mtcars)
rc <- rainbow(nrow(x), start=0, end=.3)
cc <- rainbow(ncol(x), start=0, end=.3)
hv <- heatmap(x, col = cm.colors(256), scale="column",
              RowSideColors = rc, ColSideColors = cc, margins=c(5,10),
              xlab = "specification variables", ylab= "Car Models",
              main = "heatmap(<Mtcars data>, ..., scale = \"column\")")
utils::str(hv) # the two re-ordering index vectors[两个重新排序的索引向量]

## no column dendrogram (nor reordering) at all:[#所有没有列树状图(也重新排序):]
heatmap(x, Colv = NA, col = cm.colors(256), scale="column",
        RowSideColors = rc, margins=c(5,10),
        xlab = "specification variables", ylab= "Car Models",
        main = "heatmap(<Mtcars data>, ..., scale = \"column\")")

## "no nothing"[“什么都没有”]
heatmap(x, Rowv = NA, Colv = NA, scale="column",
        main = "heatmap(*, NA, NA) ~= image(t(x))")


round(Ca <- cor(attitude), 2)
symnum(Ca) # simple graphic[简单的图形]
heatmap(Ca,             symm = TRUE, margins=c(6,6))# with reorder()[与重新排序()]
heatmap(Ca, Rowv=FALSE, symm = TRUE, margins=c(6,6))# _NO_ reorder()[_NO_重新排列()]

## For variable clustering, rather use distance based on cor():[#变量聚类,而不是使用对肺心病的距离():]
symnum( cU <- cor(USJudgeRatings) )

hU <- heatmap(cU, Rowv = FALSE, symm = TRUE, col = topo.colors(16),
             distfun = function(c) as.dist(1 - c), keep.dendro = TRUE)
## The Correlation matrix with same reordering:[#同重新排序的相关矩阵:]
round(100 * cU[hU[[1]], hU[[2]]])
## The column dendrogram:[#列树状图:]
utils::str(hU$Colv)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-22 19:40 , Processed in 0.023651 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表