Вопрос

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?

Это было полезно?

Решение 2

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');

Другие советы

By default, the imagesc function sets the YDir property to reverse. Try

set(gca,'YDir','normal');
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top