aheatmap
plots high-quality heatmaps,
with a detailed legend and unlimited annotation tracks
for both columns and rows. The annotations are coloured
differently according to their type (factor or numeric
covariate). Although it uses grid graphics, the generated
plot is compatible with base layouts such as the ones
defined with 'mfrow'
or layout
,
enabling the easy drawing of multiple heatmaps on a
single a plot -- at last!.aheatmap(x, color = "-RdYlBu2:100", breaks = NA,
border_color = NA, cellwidth = NA, cellheight = NA,
scale = "none", Rowv = TRUE, Colv = TRUE,
revC = identical(Colv, "Rowv") || is_NA(Rowv) || (is.integer(Rowv) &&
length(Rowv) > 1) || is(Rowv, "silhouette"),
distfun = "euclidean", hclustfun = "complete",
reorderfun = function(d, w) reorder(d, w),
treeheight = 50, legend = TRUE, annCol = NA,
annRow = NA, annColors = NA, annLegend = TRUE,
labRow = NULL, labCol = NULL, subsetRow = NULL,
subsetCol = NULL, txt = NULL, fontsize = 10,
cexRow = min(0.2 + 1/log10(nr), 1.2),
cexCol = min(0.2 + 1/log10(nc), 1.2), filename = NA,
width = NA, height = NA, main = NULL, sub = NULL,
info = NULL, verbose = getOption("verbose"),
gp = gpar())
ExpressionSet
objects can also be passed, in which case the expression
values are plotted (exprs(x)
).x
and is one element longer than
color vector. Used for mapping values to colors. Useful,
if needed to map certain values to certain colors. If
value is NA then the breaks are cTRUE
orNULL
(to be
consistent withRowv
(modulo the expected length for vector specifications),
and allow specifying the
distance/clustering/ordering/display parameters to be
used forRowv
should be reversed. This is
mainly used to get the rows displayed from top to bottom,
which is not the case by default. Its default value is
computed at runtime, to suitdist
(e.g. "euclidean" or "maximum").hclust
(e.g.'average'
).Rowv
or Colv
is a numeric weight vector, or provides or
computes a dendrogram. It must take 2 parameters: a
dendrogram, and a weight vectsubsetRow
. See details above.x
,
that contains text to display in each cell. NA
values are allowed and are not displayed. See demo for an
example.TRUE
.annCol
apply.TRUE
.labRow
for a list of the possible
values.fontsize
.fontsize
.info=TRUE
,
information about the clustering methods is displayed at
the bottom of the plot.TRUE
then verbose messages are
displayed and the borders of some viewports are
highlighted. It is entended for debugging purposes.pdf
, one may get generate a first blank
page, due to internals of standard functions from the
aheatmap
.
The nmf.options(grid.patch=TRUE)
, or on load time if
the environment variable 'R_PACKAGE_NMF_GRID_PATCH' is
defined and its value is something that is not equivalent
to FALSE
(i.e. not '', 'false' nor 0).pheatmap
from the heatmap
;Please read the associated vignette for more information and sample code.
# roxygen generated flag
options(R_CHECK_RUNNING_EXAMPLES_=TRUE)
## See the demo 'aheatmap' for more examples:
demo('aheatmap')
# Generate random data
n <- 50; p <- 20
x <- abs(rmatrix(n, p, rnorm, mean=4, sd=1))
x[1:10, seq(1, 10, 2)] <- x[1:10, seq(1, 10, 2)] + 3
x[11:20, seq(2, 10, 2)] <- x[11:20, seq(2, 10, 2)] + 2
rownames(x) <- paste("ROW", 1:n)
colnames(x) <- paste("COL", 1:p)
## Default heatmap
aheatmap(x)
## Distance methods
aheatmap(x, Rowv = "correlation")
aheatmap(x, Rowv = "man") # partially matched to 'manhattan'
aheatmap(x, Rowv = "man", Colv="binary")
# Generate column annotations
annotation = data.frame(Var1 = factor(1:p %% 2 == 0, labels = c("Class1", "Class2")), Var2 = 1:10)
aheatmap(x, annCol = annotation)
Run the code above in your browser using DataLab