Hello Marc,

Well, image() requires data values in a regular grid.  So you need to 
interpolate your data to a regular grid before you do your plot.  There 
are many interpolation methods, but a good place to start is to do 
linear interpolation.  You should first use expand.grid() to create the 
regular grid where to interpolate your data.  Then use the interp() 
function (in the akima package) to do the interpolation.  Finally, to do 
the plot you can use image() or better yet, the plot.surface() function 
in the 'fields' package, which is an improved version of the image() 
function.

I hope that helps,

Julian


[EMAIL PROTECTED] wrote:
> Hello R cracks
> 
> The image() function requires strictly increasing x and y values and z as a 
> matrix.
> 
> Actually, I don't have equally spaced variables, but anyway want to plot an 
> colored image() (with z-information).
> 
> An example of my problem is here:
> 
> a<-data.frame(rnorm(100), rnorm(100), runif(100)*100)
> 
> How can I plot this data as an image (x=a[,1], y=a[,2] and z=a[,3])-> 
> according to ?image.
> It has to be possible to adapt the grid size so that every grid cell in the 
> plot is coloured consequently.
> 
> Thanks for your help
> 
> Marc
> --
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to