MATLAB: Y axis lable values are not in ascending order

heatmap

Hi everyone,
I have a matrix p, 255 x 255. I used this matrix to get heatmap. Int that map X axis lalbes are in ascending oerder but Y axis valuse are descending order.
I need both axis lables in ascending order.I will put code on here and attached my heatmap.
I will really appriciate if anyone can help on this issue. Thank you.
h = heatmap(p,'colormap',summer);

Best Answer

Plot it using this
heatmap(1:size(p,1), size(p,2):-1:1, p,'colormap',summer);
Alternative:
h = heatmap(p,'colormap',summer);
h.YDisplayLabels = flipud(h.YDisplayLabels);
Related Question