[R] 2D plot with colors from 3rd variable?

Jim Lemon jim at bitwrit.com.au
Wed Mar 18 12:48:52 CET 2009


Josh wrote:
> Hi,
> I have three related variables (vectors) and would like to see their
> distribution on a 2D plot of first two variables, having colors proportional
> to the values from third variable. I could have done so by passing 3rd
> variable to the color palette, but this would disrupt the relationship
> information among them.
> I am sure there has to be some way to do it, but I don't know how. Any help
> in this direction will be appreciated.
>
>   
Hi Josh,
Have a look at color.scale in the plotrix package. This function 
converts numeric values into colors along an arbitrary color dimension.

Jim




More information about the R-help mailing list