[R] image plot

Paul Hiemstra p.hiemstra at geo.uu.nl
Mon Aug 24 18:41:16 CEST 2009


ogbos okike schreef:
> Hi,
> I am trying to use the image function to do a color plot. My matrix columns
> are labeled y and x. I tried >image(y, x) but I had error message ("Error in
> image.default(y, x) : increasing 'x' and 'y' values expected").
> Could anybody please tell me how to add these increasing 'x' and 'y' values.
> Thanks
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>   
Hi,

Please provide a reproducible example.

An example that works with image:

x = 1:10
y = seq(1,100,by =10)
z = matrix(runif(100), 10, 10)
image(x,y,z)
x = sort(runif(10))
y = sort(runif(10))
image(x,y,z)

So z is a matrix with the values and x and y tell the dimensions of each 
cell, often with equal interval.

cheers,
Paul




More information about the R-help mailing list