Reputation: 33
I'm visualizing a matrix in MATLAB with imshow
. However, I'd like the y and x axis to switch places, making x correspond to the row-index of the matrix, and y correspond to the col-index.
I also want to change the increment value of the axises to 0.01, so that row 10 has x value 0.1, row 100 has 1 and so on.
Upvotes: 1
Views: 2477
Reputation: 65430
To swap the axes you will want to change the view of the axes. By default the 2D view has the y axis vertical and x axis horizontal. You can change this by rotating the view 90 degrees.
view(-90,90) % Default is view(0, 90)
To change the increment, you will want to alter the XData
and YData
of the image
object returned by imshow
.
him = imshow(img, []);
set(him, 'XData', [0, size(img, 2)/100], 'YData', [0, size(img, 1)/100]);
Upvotes: 2