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.