[R-gregmisc-commits] r2132 - in pkg/gplots: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Aug 12 19:17:24 CEST 2016


Author: warnes
Date: 2016-08-12 19:17:24 +0200 (Fri, 12 Aug 2016)
New Revision: 2132

Modified:
   pkg/gplots/DESCRIPTION
   pkg/gplots/R/heatmap.2.R
   pkg/gplots/man/heatmap.2.Rd
Log:
Add parameter specifying the number of bins used to plot the color key

Modified: pkg/gplots/DESCRIPTION
===================================================================
--- pkg/gplots/DESCRIPTION	2016-08-12 17:15:39 UTC (rev 2131)
+++ pkg/gplots/DESCRIPTION	2016-08-12 17:17:24 UTC (rev 2132)
@@ -23,8 +23,8 @@
 Depends: R (>= 3.0)
 Imports: gtools, gdata, stats, caTools, KernSmooth
 Suggests: grid, MASS
-Version: 3.0.1
-Date: 2016-03-30
+Version: 3.0.3
+Date: 2016-08-01
 Author: Gregory R. Warnes, Ben Bolker, Lodewijk Bonebakker, Robert
 	Gentleman, Wolfgang Huber Andy Liaw, Thomas Lumley, Martin
 	Maechler, Arni Magnusson, Steffen Moeller, Marc Schwartz, Bill

Modified: pkg/gplots/R/heatmap.2.R
===================================================================
--- pkg/gplots/R/heatmap.2.R	2016-08-12 17:15:39 UTC (rev 2131)
+++ pkg/gplots/R/heatmap.2.R	2016-08-12 17:17:24 UTC (rev 2132)
@@ -65,6 +65,7 @@
                        ## color key + density info
                        key = TRUE,
                        keysize = 1.5,
+                       keygrid=255,
                        density.info=c("histogram","density","none"),
                        denscol=tracecol,
                        symkey = any(x < 0, na.rm=TRUE) || symbreaks,
@@ -670,19 +671,27 @@
           max.raw <- max.breaks
         }
 
-      z <- seq(min.raw, max.raw, by=min(diff(breaks)/100))
+      z <- seq(min.raw, max.raw, length.out=keygrid)
       image(z=matrix(z, ncol=1),
-            col=col, breaks=tmpbreaks,
-            xaxt="n", yaxt="n")
+            #x=matrix(z),
+            #y=0,
+            col=col,
+            breaks=tmpbreaks,
+            xlab="",
+            xaxt="n",
+            yaxt="n")
 
-      par(usr=c(0,1,0,1))
       if (is.null(key.xtickfun)) {
-          lv <- pretty(breaks)
-          xv <- scale01(as.numeric(lv), min.raw, max.raw)
-          xargs <- list(at=xv, labels=lv)
+        usr <- par("usr")
+        par(usr=c(usr[1], usr[2], 0, 1))
+        lv <- pretty(breaks)
+        xv <- scale01(as.numeric(lv), min.raw, max.raw)
+        xargs <- list(at=xv, labels=lv)
       } else {
-          xargs <- key.xtickfun()
+        xargs <- key.xtickfun()
       }
+
+
       xargs$side <- 1
       do.call(axis, xargs)
       if (is.null(key.xlab)) {

Modified: pkg/gplots/man/heatmap.2.Rd
===================================================================
--- pkg/gplots/man/heatmap.2.Rd	2016-08-12 17:15:39 UTC (rev 2131)
+++ pkg/gplots/man/heatmap.2.Rd	2016-08-12 17:17:24 UTC (rev 2132)
@@ -77,6 +77,7 @@
            # color key + density info
            key = TRUE,
            keysize = 1.5,
+           keygrid = 255,
            density.info=c("histogram","density","none"),
            denscol=tracecol,
            symkey = any(x < 0, na.rm=TRUE) || symbreaks,
@@ -215,6 +216,7 @@
   % Color key and density info
   \item{key}{logical indicating whether a color-key should be shown.}
   \item{keysize}{numeric value indicating the size of the key}
+  \item{keygrid}{number of bins used to plot the color-key}
   \item{density.info}{character string indicating whether to superimpose
     a 'histogram', a 'density' plot, or no plot ('none') on the
     color-key.}
@@ -437,7 +439,18 @@
                return(list(labels=FALSE, tick=FALSE))
           })
 
+ heatmap.2(x,
+          breaks=256,
+          keygrid=10
 
+          )
+
+ heatmap.2(x,
+          breaks=256,
+          keygrid=1001
+          )
+
+
  ##
  ## Show effect of z-score scaling within columns, blue-red color scale
  ##



More information about the R-gregmisc-commits mailing list