[R] image plot but data not on grid.

Hadley Wickham hadley at rice.edu
Fri Aug 6 22:26:38 CEST 2010


On Fri, Aug 6, 2010 at 9:24 AM, W Eryk Wolski <wewolski at gmail.com> 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.

library(ggplot2)
qplot(x, y, fill = z, data = df, geom = "tile")

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list