sorty
Sorts the rows of a heatmap by the values in one of its columns.
Category: Graphics > 2-D and 3-D Plots
Syntax
sorty(h)
Sorts the rows by the first displayed column, in ascending order.
sorty(h, column)
Sorts by the column named column.
sorty(h, column, direction)
Chooses 'ascend' or 'descend' order.
Description
This is the counterpart of sortx. It rearranges YDisplayData and the rows of ColorDisplayData without altering the underlying data. The sort is stable and places missing values last.
Input arguments
h- Handle of a
heatmapchart. column- Label of the column to sort by, as it appears in
XDisplayData. direction'ascend'(default) or'descend'.
Example
Reordering rows in descending order
hm = heatmap([3 1 2; 6 4 5]);
sorty(hm, '1', 'descend');
disp(hm.YDisplayData')
disp(hm.ColorDisplayData)
Output
{'2'} {'1'}
6 4 5
3 1 2