Why does "imagesc" shift the shape upward when plotting density?

When I am plotting the shape representing the density it shifts upwards slightly compared to the actual shape when using "imagesc". I expect both the shapes to be on the same location on the grid. How do I fix this?

 Akzeptierte Antwort

To resolve this set the "YDir" to "normal". By default, the 'imagesc' functions invert the y-axis direction when the image is displayed on an axes by setting the "YDir" property to "reverse". To invert the y-axis direction, set the 'YDir' property to 'normal', as follows:
load clown
clims = [10 60];
imagesc(flipud(X),clims)
colormap(gray)
set(gca,'YDir','normal')

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020a

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by