[R] vertically oriented color key in heatmaps

adrian at maths.uwa.edu.au adrian at maths.uwa.edu.au
Wed Aug 15 04:26:34 CEST 2007

Rajarshi Guha <rguha at indiana.edu> writes:

> Hi, I have some data which I was plotting using image(). I wanted to
> add a vertical color key to the plot and I found that heatmap.2 in
> gplots does let me add a color key. However, I was thinking of a
> vertical bar with the color range rather than  the style that gplots
> provides.

In package 'spatstat' this is the default behaviour for plotting a pixel
image (object of class "im").
If M is your matrix of data

         Z <- as.im(t(M))
         plot(Z, col=topo.colors(128))

More information about the R-help mailing list