Hat on letter on x/ylabel WITHOUT using LaTeX?
10 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I am wondering how I can add a 'hat' above a character on a plot without, however, changing the font to LaTeX, as I was my font style to remain default.
Thanks!
1 件のコメント
dpb
2020 年 4 月 23 日
LaTeX is not the font, it's the text interpreter...sure probably know that, but just for clarification/precision of terminology.
Can't be done w/ TeX as an interpreted sequence; TeX only displays a character from the set in the table outlined in the documentation under the 'Interpreter' property at text function entry.
You can try to use text to write two characters
採用された回答
dpb
2020 年 4 月 23 日
figure, plot(sort(rand(10,4))) % preliminaries...
% engine
hTxt=text(4,0.6,'x'); % location arbitrary for given data set
hTxt(2)=text(4.0,0.6,'\bf\wedge','VerticalAlignment','bottom','FontSize',6);
results in
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/286902/image.jpeg)
Not perfect bit fiddling w/ positioning, font size, etc., etc., may improve things a little. It looked less obtrusive and more aligned over the character on the figure itself than the saved one here for some reason.
5 件のコメント
Robert U
2020 年 4 月 23 日
You can use the rotation-property of text() but the circumflex won't rotate properly in Matlab 2019b. Don't know whether this is fixed in 2020a.
その他の回答 (1 件)
Robert U
2020 年 4 月 23 日
Hi Minas Emiris,
convert the circumflex from unicode to string via sprintf (see here, unicode table for combining characters found here) and use append to create the string for the labels (as shown here):
circumFlex = sprintf('\x0302')
fh = figure;
ah = axes(fh);
ah.XLabel.String = append('T',circumFlex);
Kind regards,
Robert
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!