[R] image plot with multiple x values
baptiste Auguié
ba208 at exeter.ac.uk
Fri Aug 17 20:51:59 CEST 2007
Hi,
New to R, I don't find a way to plot the following data with image():
x is a N * M matrix
y is a vector of length M
z is a N*M matrix
I wish to plot z as a greyscale image, but my x axis is different for
every row of the z data.
Here is a minimal example,
> theta<-c(3:6) # N
> y<-c(1:5) # M
>
> x<-theta%*%t(y)# N * M
> z<-sin(x) # N * M
>
> image(z)
This doesn't give what I want, as the x axis needs to be shifted as
we go from line to the following. (probably clearer if you plot
matplot(x,z): the curves are shifted)
The way I see it, I need either to construct a bigger matrix with all
possible values of x giving the new dimension and arbitrary values
for the missing points, or find a plotting function that would plot
lines by lines. The ordering of the x and z values is giving me a
headache on the first idea, and I can't find any option / alternative
to image.
Thanks in advance!
baptiste
More information about the R-help
mailing list