This is followed by a hack, which is almost certainly not an ideal solution, but can help you get started.
Create your own version of the heatmap.2 function called hm3 . In the code for hm3 comment out all the lines between:
if (missing(lhei) || is.null(lhei))
and calling layout :
layout(lmat, widths = lwid, heights = lhei, respect = FALSE)
this is a big piece of code, maybe 30 lines. Now the following code creates two heat maps with dendrograms and next to each other:
x <- as.matrix(mtcars) lhei <- c(1.5, 4,1.5,4) lwid <- c(1.5, 4,1.5,4) layout(rbind(c(4,3,8,7),c(2,1,6,5)), widths = lwid, heights = lhei, respect = FALSE) hm3(x) hm3(x)

It is clear that this will require significant improvements to make it look beautiful (and the large area of โโplotting, I squished everything to be a reasonable size for publication here).
This is completely untested. It is likely that the use of any of the parameters of the hm3 function that control the appearance of the graph will lead to a slightly weaker situation. But this can be a good starting point for your own experiments to solve these problems.