How to flip heatmap Y axis

조회 수: 82 (최근 30일)
Pablo López
Pablo López 2020년 10월 31일
댓글: Pablo López 2020년 11월 18일
Hi all,
I am creating a heatmap based on a table with x and z coordinate and the parameter value for each position. I copy here an image of the table.
The command I am using to create the heatmap is this one:
figure = heatmap(table,'x','z','ColorVariable','value');
And the heatmap created is this one.
Question
Does anybody know how could I flip the z values to show the '0' value at the bottom of the heatmap and the value '0.022' at the top instead of the opposite?
Thanks in advance

채택된 답변

dpb
dpb 2020년 10월 31일
hHM=heatmap(table,'x','z','ColorVariable','value'); % make heatmap, keep handle
hHM.NodeChildren(3).YDir='normal'; % turn Y-Axis normal direction
Yet another case where TMW has gotten far too clever and hidden the useful/needed properties for some reason only they can divine...
  댓글 수: 3
dpb
dpb 2020년 10월 31일
편집: dpb 2020년 11월 1일
Hmmm....hadn't thought of that.
To do that programmatically, use
hHM.YDisplayData=flip(hHM.YDisplayData);
Why to have to resort to such trickery instead of just being able to set the axis direction for the axis of choice like any other graphic axis is beyond the pale, however.
This recent penchant (that seems to only be accelreating with time) to create these black/dark-gray graphics objects is just totally misguided im(ns)ho.
Pablo López
Pablo López 2020년 11월 18일
Thanks! Much more elegant and efficient!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by