# How to make “molbio-style heat maps” in Mathematica [duplicate]

Possible Duplicate:
How to combine ArrayPlot's?

[NB: This question is specifically addressed to those who have used (or attempted to use) Mathematica to generate "heat maps" (as the term is used in the context of high-throughput biology research).]

The short version of this question is:

What functions does Mathematica have to produce "heat maps" like those used by molecular biologists to visualize high-throughput gene expression data?

(For reasons I describe in more detail below, ArrayPlot and MatrixPlot are completely inadequate for the task.)

Long version:

In the field of high-throughput molecular biology research, so-called "heat maps" have become a veritable workhorse format for data visualization (even though the data never has anything whatsoever to do with heat). For example, here's a typical one (from the Wikipedia entry on heat maps):

(In the example above, the heat map is decorated with dendrograms along the top and right edges. For the purposes of this question, please ignore these dendrograms. All I'm interested in is the central array of colored rectangles.)

Initially "heat maps" were used for visualizing high-throughput gene expression data obtained from microarray-based experiments, but nowadays they are used for visualizing any type of data. Given that such "heat maps" are so ubiquitous in mainstream biology research, I had expected that Mathematica would have by now implemented multiple specialized functions and/or packages for producing and manipulating them. After looking very hard for such functions, however, I'm beginning to suspect, in shock, that I may have been completely wrong about this.

The purpose of this question is to get confirmation that this suspicion is basically right, or (hopefully) information showing that it is not so.

The closest I have found are the functions ArrayPlot and MatrixPlot. At first blush these functions seem to fit the bill, until one tries to perform the simplest manipulations with the Graphics objects they produce.

For example, just to display side-by-side two ArrayPlot-generated heat maps of equal heights but unequal widths is a nightmare; e.g.:

Now, I'm not a Mathematica novice; I've been bashing my skull against it since the early 90's. Still, it took me about 6 hours of mostly failed attempts, and of far more hacking at the internals of these Graphics objects than such a trivial task should ever require1. (BTW, the situation with MatrixPlot was not any better.)

This humbling experience has convinced me that, whatever other utility ArrayPlot and MatrixPlot may have they cannot possibly be considered adequate tools for making heat maps.

(I suspect that the reason why ArrayPlot- and MatrixPlot-generated Graphics are so difficult to work with (as "heat maps" at least) is that they are based on Raster objects, but this is just a hunch, since the Mathematica documentation, as usual, remains safely oracular on what may be going on.)

So the question at this point is the one at the top of this post.

1I'd love to post the function that I eventually managed to implement to solve the problem, but the post I submitted about this problem was closed by the Gods.

## merged by Mr.Wizard♦Sep 30 '12 at 14:52

This question was merged with How to combine ArrayPlots? because it is an exact duplicate of that question.

• Isn't this question, in essence, the same as your earlier closed one, with the added issue of getting the right ColorFunction? Have a look at the documentation for Blend. – Verbeia Sep 29 '12 at 22:27