Search code examples
rimageplotdefaultaxes

Is there a way of forcing the image function in R not to normalize coordinates?


When using the image function in R it normalized the length of the dimensions of the input matrix so X and Y axes go from 0 to 1.

Is there a way of telling the image function not to normalize these numbers?

I need to do so in order to overlay different kinds of data and normalizing all these coordinates into the [0,1] space is very tedious.

EDIT: The answer provided by Greg explains the situation.


Solution

  • A reproducible example would be very helpful here. Generally if you only give image a z matrix then the function chooses default x and y values that work, I think this is what you are seeing. On the other hand if you give image an x vector and a y vector then it uses that information to construct the graph. If the x/y vectors have a length equal to the corresponding dimension of z then those values represent the centers of the rectangles, if x/y is 1 longer than the corresponding dimension of z then they represent the corners of the rectangles. This gives you a lot of control over the things that you mention.

    If this does not answer the question then give us a self contained reproducible example to work with.