[R] How can I create colors correspond to the number of a variable?

Jim Lemon jim at bitwrit.com.au
Wed Sep 17 11:16:46 CEST 2014

On Tue, 16 Sep 2014 09:34:39 PM wszsdmjj wrote:
> I need to create a color vector with 4000 colors, and I have another
> variable, it contains 4000 element. If my variable is number of bed, 
and I
> want the color corresponds to the number of bed in this variable. How 
> I do?
Hi wszsdmjj,
I assume that you have 4000 numbers of which all may be different and 
you want to assign colors that will represent these values along some 
dimension. I think that the answer that John gave is probably correct, but 
if not, have a look at the color.scale function in the plotrix package.


More information about the R-help mailing list