Re: [R] Adding Scale to image

From: Jim Lemon <jim_at_bitwrit.com.au>
Date: Wed 31 Jan 2007 - 10:05:09 GMT

Peter Robinson wrote:
> Dear List,
>
> I have used the image() function to show a heat plot of a matrix of data
> whose intensity is color-coded. I have two questions that I have not
> been able to solve by using the help system or google.
>
> 1) How can one add a scale/legend that shows what numerical values a
> given color corresponds to?

You can use the gradient.rect function in the plotrix package to display a rectangular bar with a specified number of color "slices" in it. For an example of how to make this into a color legend, see the color2D.matplot function in the same package. If this is of interest to R users, I could include a color.legend function in plotrix that would do it all.

Jim



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed Jan 31 21:05:46 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 31 Jan 2007 - 10:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.