Wittner, Ben, Ph.D.
2008-May-28 20:02 UTC
[R] interactive heatmap dendrogram locator layout grid package
Hello, I would like to display a heatmap with dendrograms and allow the user to click on either dendrogram to choose a sub-dendrogram. The function heatmap() uses layout() and image() and the plot method of dendrogram to plot the heatmap and dendrograms, but if locator() is then called and the user clicks, the coordinates returned from locator() are with respect to the last thing plotted (e.g., one of the dendrograms) regardless of where the user clicked. It seems that the grid package's grid.locator() will return global coordinates that probably can be used in a straightforward way to find what leaf viewport the user clicked in and then translated to that viewport's coordinates. I don't see, however, a grid.image() function, so I don't know how to plot the heatmap when using grid. Any suggestions would be appreciated. Thanks in advance. -Ben p.s., I think it would be great if locator() interacted with layout() so that locator() returned the which portion of the display the user clicked in (perhaps by giving the corresponding number in the mat argument to layout()) as well as the coordinates of the clicked point in the user coordinates last set when that part of the display was being drawn in. The information transmitted in this electronic communica...{{dropped:16}}