[R] x y plot with z coordinate scaling to a color value

Jim Lemon jim at bitwrit.com.au
Wed May 19 12:41:02 CEST 2010


On 05/19/2010 08:24 PM, Jannis wrote:
> Dears,
>
> before I start programming my own function I would like to ask you whether there is any function already available that lets me plot a x/y plot with the colors of the points determined by scaling a third variable z into a defined colorramp?
>
> Until now I am using a wild combination of functions to create a colorvector by hand, then calling
>
> plot(x,y,col=colors)
>
> and then using color.legend() from plotrix to add a colorbar. Is there anything where I can just call (for example)
>
> plot(x,y,z)
>
>
> and get a plot and a colorbar next to it?
>
> If not I have to program that myself because my current way involves a lot of steps and readjusting plotting regions.
>
Hi Jannis,
Have a look at the example for color.scale in the plotrix package, and 
you already know about color.legend.

Jim



More information about the R-help mailing list