[R] image plot but data not on grid.

David Winsemius dwinsemius at comcast.net
Fri Aug 6 16:49:38 CEST 2010


On Aug 6, 2010, at 10:24 AM, W Eryk Wolski wrote:

> Hi,
>
> Would like to make an image
> however the values in z are not on an uniform grid.
>
> Have a dataset with
> length(x) == length(y) == length(z)
> x[1],y[1] gives the position of z[1]
>
> and would like to encode value of z by a color.
>
> looking for something like
> plot(x,y, col = z)
> where col for z is cleverly chosen from a colorscale.

?palette
??palette  # for other coloring options
?colorRamp

# random integer index from default palette for coloring of random x,y  
points:

plot(rnorm(20), rnorm(20), col=palette()[ runif(20, 1,10) ]    )

# The cleverness is left to you.
-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list