Label the color bar for a heat map created with heatmap(x,y,data)
173 ビュー (過去 30 日間)
古いコメントを表示
How can I label the color bar (e.g. 'Pressure (Pa)' or 'Temperature (K)') for a heat map created with h = heatmap(x,y,data)? I don't see a colorbar handle or property in h.
0 件のコメント
採用された回答
Sanush
2020 年 7 月 22 日
dat = rand(5);
heatmap(dat)
annotation('textarrow',[1,1],[0.5,0.5],'string','My Text', ...
'HeadStyle','none','LineStyle','none','HorizontalAlignment','center','TextRotation',90);
その他の回答 (2 件)
Rohan Kadambi
2023 年 12 月 12 日
You can reveal hidden properties of handle objects by casting them to struct. Doing this to the HeatMapChart handle reveals a handle to the colorbar:
h = heatmap(rand(10));
hs = struct(h);
ylabel(hs.Colorbar, "Colorbar Label");
0 件のコメント
KSSV
2017 年 10 月 27 日
[X,Y,Z] = peaks(100) ;
surf(X,Y,Z) ;
h = colorbar;
ylabel(h, 'My Colorbar')
3 件のコメント
arnold
2019 年 4 月 4 日
I am looking for the same. I'd appreciate any hint to get around this problem.
I was really happy to see them introduce the heatmap function but it again is quite inconsistent with the rest. I can't get a handle on the colorbar label to set the string like one usually can. Really annoying for the diagram tools to be so inconsistent still, I thought this was gonna go away when they changed it some years ago.
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!