[R] Legend that is big?

Jim Lemon jim at bitwrit.com.au
Sun Jan 22 07:46:02 CET 2012


On 01/22/2012 06:56 AM, Kevin Burton wrote:
> Of course by entering 'blah' you just get a legend of one value. I guess I would like to remove the text altogether and put the colored boxes (or circles) right next to each other. This would form sort of a gradient. So say I needed a legend for 100 colored values on the plot. The colors are generated by:
> colors<- rainbow(100)
> How would I make such a legend?

Hi Kevin,
It sounds like you want something like color.legend (plotrix) that draws 
a rectangle with as many colors as you like. However 100 colors would 
probably require a legend as big as one side of the plot, and you 
certainly couldn't get 100 readable labels on it. More like 10.

Jim



More information about the R-help mailing list