Reputation: 181
I am using imagesc on my image1 with is a 2023 x 2023 pixel image.
figure(1)
imagesc(-1016:1015, -1016:1015, image1);
I am atempting to create a cartesian coordinate axis on the image, however the y-axis has range goes from negative to positive instead of positive to negative. I have tried a few different ways to fix the problem but nothing is working.
Tried:
imagesc(-1016:1015, 1016:-1015, image1);
imagesc(-1016:1015, 1016:-1:-1015, image1);
imagesc(-1016:1015, 1016:1:-1015, image1);
imagesc(-1016:1015, -(-1016:1015), image1);
set(gca,'YDir','reverse');
How do you reverse the scale on the y-axis using imagesc?
Upvotes: 0
Views: 10670
Reputation: 181
So the I had to do two things first I added a negative to the y-axis --> -(y-axis) and then I set the y-axis direction to normal. If I only did one the axis would look correct but the image was flipped across its horizontal midpoint.
figure(1)
imagesc(-1016:1015,-(-1016:1015),image1);
set(gca,'YDir','normal');
Upvotes: 0
Reputation: 1744
By default, the imagesc
function sets the YDir
property to reverse
. Try
set(gca,'YDir','normal');
Upvotes: 3