[R-gregmisc-users] SF.net SVN: r-gregmisc:[1941] trunk/gplots/R/heatmap.2.R
Brought to you by:
warnes
|
From: <wa...@us...> - 2015-04-23 19:09:24
|
Revision: 1941
http://sourceforge.net/p/r-gregmisc/code/1941
Author: warnes
Date: 2015-04-23 19:09:17 +0000 (Thu, 23 Apr 2015)
Log Message:
-----------
Patch submitted by Ilia Kats:
- easily extract and plot subclusters from a big heatmap using the
same colorkey, by passing a dendgrogram of the subcluster together
with the full data matrix and, optionally, the breaks of the full
heatmap in order to obtain the same color scaling. This is useful if
one wants to plot several subclusters as different panels in a
paper, but maintain consistent color coding.
- Improves the behavior of the color key axis labels, as they now
honor par("cex") and par("cex.lab").
Modified Paths:
--------------
trunk/gplots/R/heatmap.2.R
Modified: trunk/gplots/R/heatmap.2.R
===================================================================
--- trunk/gplots/R/heatmap.2.R 2015-04-23 18:49:23 UTC (rev 1940)
+++ trunk/gplots/R/heatmap.2.R 2015-04-23 19:09:17 UTC (rev 1941)
@@ -194,6 +194,8 @@
rowInd <- order.dendrogram(ddr)
if(length(rowInd)>nr || any(rowInd<1 | rowInd > nr ))
stop("Rowv dendrogram doesn't match size of x")
+ if (length(rowInd) < nr)
+ nr <- length(rowInd)
}
else if (is.integer(Rowv))
{ ## Compute dendrogram and do reordering based on given vector
@@ -230,6 +232,8 @@
colInd <- order.dendrogram(ddc)
if(length(colInd)>nc || any(colInd<1 | colInd > nc ))
stop("Colv dendrogram doesn't match size of x")
+ if (length(colInd) < nc)
+ nc <- length(colInd)
}
else if(identical(Colv, "Rowv")) {
if(nr != nc)
@@ -633,8 +637,8 @@
}
else
{
- min.raw <- min(x, na.rm=TRUE) ## Again, modified to use scaled
- max.raw <- max(x, na.rm=TRUE) ## or unscaled (SD 12/2/03)
+ min.raw <- min.breaks
+ max.raw <- max.breaks
}
z <- seq(min.raw, max.raw, length=length(col))
@@ -661,7 +665,7 @@
key.xlab <- "Value"
}
if (!is.na(key.xlab)) {
- mtext(side=1, key.xlab, line=par("mgp")[1], padj=0.5)
+ mtext(side=1, key.xlab, line=par("mgp")[1], padj=0.5, cex=par("cex") * par("cex.lab"))
}
if(density.info=="density")
@@ -687,7 +691,7 @@
if (is.null(key.ylab))
key.ylab <- "Density"
if (!is.na(key.ylab))
- mtext(side=2,key.ylab, line=par("mgp")[1], padj=0.5)
+ mtext(side=2,key.ylab, line=par("mgp")[1], padj=0.5, cex=par("cex") * par("cex.lab"))
}
else if(density.info=="histogram")
{
@@ -710,7 +714,7 @@
if (is.null(key.ylab))
key.ylab <- "Count"
if (!is.na(key.ylab))
- mtext(side=2,key.ylab, line=par("mgp")[1], padj=0.5)
+ mtext(side=2,key.ylab, line=par("mgp")[1], padj=0.5, cex=par("cex") * par("cex.lab"))
}
else
if (is.null(key.title))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|