Hi,
I am learning to draw a heatmap in matlab. I can add x-axis labels or numbers. But I don't know how to add ticks on x-axis corresponding to the numbers. Can anyone help me with this? Thanks!
the set(gca,'XTick') works when you use plot but doesn't work for a heatmap object. :(

 Akzeptierte Antwort

the cyclist
the cyclist am 31 Jul. 2011

1 Stimme

plot(1:10)
set(gca,'XTick',2:2:10)

1 Kommentar

yakub sharif
yakub sharif am 11 Feb. 2020
doesn't work with mine
I am using the code
heatmapHandle = heatmap(surface_grid2, 'ColorMap', jet(100))
heatmapHandle.YDisplayData = flipud(heatmapHandle.YDisplayData);
and want to label the x axis with floating numbers like 1:.5:10

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Haozi
Haozi am 1 Aug. 2011

0 Stimmen

In the file exchange folder, there is a customerized heatmap function, that really solves the question. But still, thank you, the cyclist!

Kategorien

Mehr zu Data Distribution Plots finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by