Is it possible to apply Latex formatting in heatmaps?
12 ビュー (過去 30 日間)
古いコメントを表示
I created a heatmap with function 'heatmap(xvalues,yvalues,cdata)'. It seems that latex expressions like '^', '_', etc. have not been interpreted in 'xvalues' and 'yvalues'. So I want to know how to display latex-format elements in the 'xvalues' and 'yvalues' position of heatmap? Or how to set xticklabels and yticklabels with latex format for heatmap?
0 件のコメント
回答 (1 件)
Shlok
2024 年 10 月 24 日 7:38
Hi Lyu,
The support for controlling text interpreter (including LaTeX) for displayed text using the “Interpreter” property is added from R2023b. You can upgrade to R2023b or a later version to use this feature. I have attached the link of release notes of R2023b for further context:
You can set the “TickLabelInterpreter” property of heatmap to “latex” for the tick labels to show the LaTeX-formatted elements. Here’s a sample implementation for the same:
% Sample data
xvalues = {'\alpha', '\beta', '\gamma', '\delta', '\epsilon'};
yvalues = {'\theta', '\lambda', '\mu', '\nu', '\omega'};
cdata = rand(5);
% Create heatmap
h = heatmap(xvalues, yvalues, cdata);
% Set the tick label interpreter to LaTeX
h.NodeChildren(3).TickLabelInterpreter = 'latex';
This method will ensure that the labels in both the x-axis and y-axis display correctly formatted LaTeX symbols.
To know more about heatmaps, refer to the following MathWorks Documentation link:
0 件のコメント
参考
カテゴリ
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!