MATLAB Answers

How to flip heatmap Y axis

59 views (last 30 days)
Pablo López
Pablo López on 31 Oct 2020
Commented: Pablo López on 18 Nov 2020
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.
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

Accepted Answer

dpb on 31 Oct 2020
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...
Pablo López
Pablo López on 18 Nov 2020
Thanks! Much more elegant and efficient!

Sign in to comment.

More Answers (0)





Community Treasure Hunt

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

Start Hunting!