Search
Question: Heatmap.2 Trace Line Thickness
0
6.9 years ago by
Michael Goodson10 wrote:
I have made a simple heat map (two columns, twelve genes each). The command I use is: heatmap.2(WATVal.mtx, labRow = WATNames, col=redgreen (40), symbreaks = TRUE, tracecol="grey98", Rowv = FALSE, Colv = FALSE, dendrogram = "none", margins = c(15,25)) Where WATVal.mtx is the data matrix and WATNames is a data frame with row labels. I would like to make the trace line thicker. How do I go about doing this? I have tried variations on the lwd command without success. Thanks, Michael [[alternative HTML version deleted]]
modified 6.9 years ago by Davis, Wade350 • written 6.9 years ago by Michael Goodson10
0
6.9 years ago by
Michael, Heatmap.2 is my favorite heat map function because of its flexibility and options, but I've learned that if you really want to customize things with (any) heat map, you have to edit the code at some point. Look at the code of heatmap.2 by typing heatmap.2. Copy and paste that into an editor. Look at the part of the code: if (trace %in% c("both", "column")) { retval$vline <- vline vline.vals <- scale01(vline, min.scale, max.scale) for (i in colInd) { if (!is.null(vline)) { abline(v = i - 0.5 + vline.vals, col = linecol, lty = 2) } xv <- rep(i, nrow(x.scaled)) + x.scaled[, i] - 0.5 xv <- c(xv[1], xv) yv <- 1:length(xv) - 0.5 lines(x = xv, y = yv, lwd = 1, col = tracecol, type = "s") } } if (trace %in% c("both", "row")) { retval$hline <- hline hline.vals <- scale01(hline, min.scale, max.scale) for (i in rowInd) { if (!is.null(hline)) { abline(h = i + hline, col = linecol, lty = 2) } yv <- rep(i, ncol(x.scaled)) + x.scaled[i, ] - 0.5 yv <- rev(c(yv[1], yv)) xv <- length(yv):1 - 0.5 lines(x = xv, y = yv, lwd = 1, col = tracecol, type = "s") } } I tested it just briefly, but if you change the value of lwd in the lines() function, you will have what you want. Create your own function (say heatmap.3) using the entire code, but change that portion. Then your new function heatmap.3 will get the job done. Wade -----Original Message----- From: Michael Goodson [mailto:mlgoodson@ucdavis.edu] Sent: Thursday, January 05, 2012 8:09 PM To: bioconductor at r-project.org Subject: [BioC] Heatmap.2 Trace Line Thickness I have made a simple heat map (two columns, twelve genes each). The command I use is: heatmap.2(WATVal.mtx, labRow = WATNames, col=redgreen (40), symbreaks = TRUE, tracecol="grey98", Rowv = FALSE, Colv = FALSE, dendrogram = "none", margins = c(15,25)) Where WATVal.mtx is the data matrix and WATNames is a data frame with row labels. I would like to make the trace line thicker. How do I go about doing this? I have tried variations on the lwd command without success. Thanks, Michael [[alternative HTML version deleted]]