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?

 採用された回答

MathWorks Support Team
MathWorks Support Team 2020 年 11 月 10 日

0 投票

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2020a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by