Direction of data/axes using heatmap

3 ビュー (過去 30 日間)
Jack Naumann
Jack Naumann 2018 年 8 月 31 日
コメント済み: Jack Naumann 2018 年 9 月 3 日
Hi there,
I am creating a heatmap using the following code and am generally happy with the results
h=heatmap(data_table,'Cent_Deviation','Height','GridVisible','off')
My only issue is that the y axis is 'upside down' for my purposes - it is a measure of height yet the lowest values are at the top of the figure. Any ideas how to create this heatmap with the smallest y axes run from low to high (as with any 'normal' plot)
Thanks in advance
jack

回答 (1 件)

Naman Chaturvedi
Naman Chaturvedi 2018 年 9 月 3 日
Hi Jack,
You can use the yvalues property of heatmap and use the inverted array of the y axis values to do what you want.
For example: instead of using
>>h=heatmap(data_table);
use
>>h=heatmap([1 2 3 4 5],[5 4 3 2 1],data_table);
HTH.
  1 件のコメント
Jack Naumann
Jack Naumann 2018 年 9 月 3 日
thanks for your response Naman,
Just a bit of clarification though - does the approach you use not assume the data has already been aggregated i.e. the values in the table directly correspond to the colours in the heatmap - while the approach I used whereby the fields to be used in the heatmap are defined and the function aggregates (a count in this case)? So I would have to do the aggregation separately? Does this not remove half the purpose of the function? Or am I missing something?
thanks again

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by