[Rd] Enhanced heatmap, barplot functions

Warnes, Gregory R gregory_r_warnes at groton.pfizer.com
Mon Nov 24 22:39:41 MET 2003


I've just uploaded gregmisc 0.8.6 to CRAN, it should show up in the package
tree shortly.   It contains both an enhanced barplot() [named barplot2 in my
code] and an enhanced heatmap() function that I would like to see propagate
to the base and mva packages respectively. I've checked the code for both
functions against the code in R 1.8.1, and these functions have all of the
latest features/patches.

The barplot2 code is a drop-in replacement for the current barplot() command
which adds these features:

- control color of the plot region
- allow either/both axes to be plotted on a log scale
- allow grid-lines to be shown on the plot
- plot confidence intervals when standard error is provided
- 'add' parameter to allow plotting onto an existing canvas

barplot2() is mostly contributed changes by Marc Schwartz.

The heatmap code is an almost* drop-in replacement for the standard heatmap
function.  It adds:

- ability to specify 'breaks' which define how numeric ranges are assigned
to colors 
* a variant mechanism for specifying whether row or column dendograms should
be generated and plotted: dengrogram="row", "column" "none" or "both".
This differs from R's standard heatmap, which does this by Rowv=NA or
Colv=NA, which also prevents *reordering* the rows/columns.   
- changes the default colors to 'heat.colors' instead of 'topo.colors',
which seems more appropriate for continuous data.
- allow visual separation of row / column blocks with a solid (usually
background) color 'border'
- allow text to be placed within colored cells (ie for p-value significance
flags)
- automatically provide a color-key when the data is not internally scaled
(scaling is now off by default)
- add 'level trace' lines.  These lines, which can run down rows or across
columns represent the scale of the measurement by the distance of the line
within a cell from the lower or left side of the color block.  These lines
allow one to visually compare the scale of measurements more accurately than
is possible from the colors themselves.  [Visually it is almost impossible
to decide that this red is twice intense that red. This line makes this type
of comparison simple.]

I made these changes for presentation of fold-change heatmaps.  The
specification of 'breaks' allows for the mapping of colors to ranges to be
made symmetric around +-1, for the space between +-1 to be 'collapsed' into
a single color, and for extreme values to be 'collapsed' into a single color
block instead of bleaching out all of the lower values.  In this context, a
color key becomes invaluable, and if the plotted data is the result of model
fitting, one wants to add p-value flags, and to select a meaningful column
order instead of depending on the dendrogram or the original matrix order.

-G

Gregory R. Warnes, Ph.D.
Senior Coordinator
Groton Non-Clinical Statistics
Pfizer Global Research and Development
 <<Warnes, Gregory R.vcf>> 


LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}



More information about the R-devel mailing list