Reputation: 2402
I have an mxn matrix in matlab, and I'm trying to use the image function on it. When I do, it automagically makes the axes 0:m, and 0:n.
The image corresponds to a map of intensity in a two dimensional space (in mm), so the axis 0:m (m is about 12000) should be labelled 0:6.5 (mm). Similarly for the other axis.
I've tried:
axis([x_min x_max, y_min y_max])
I've also tried:
HANDLE.XTick = [0:[step size]:6.5];
The first of these replotted the image to only show the elements of the matrix between the limits (i.e. it shows a tiny fraction of the matrix).
The second one leaves the image as it should be, but crams all the ticks at the very beginning of the axis (so the ticks lie between 0 and 6.5, on an axis that runs from 0:12000).
I want the entire matrix imaged, but with the axis labelled between 0 and 6.5.
I hope I've made myself clear.
Upvotes: 2
Views: 77
Reputation: 1051
First, you need to create two vectors to hold your x and y values, with the same size as your image. Assuming that both of these range from 0 to 6.5, and your image is 12000 by 12000 pixels:
x = linspace(0, 6.5, 12000);
y = linspace(0, 6.5, 12000);
image(x, y, image_matrix);
where image_matrix
is the 12000 by 12000 matrix that contains your data. By default, image
uses a coordinate system that has its origin at the top left corner of the image. You can change this with fliplr(image_matrix)
and flipud(image_matrix)
.
Upvotes: 1