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?

 Accepted Answer

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

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Release

R2020a

Tags

Community Treasure Hunt

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

Start Hunting!