TickLabelInterpreter axis ticks bold

21 ビュー (過去 30 日間)
Red Li
Red Li 2018 年 6 月 21 日
回答済み: Abdulrahman BIN Rabiah 2019 年 2 月 14 日
I want to apply latex interpreter to axis numbers set(gca,'TickLabelInterpreter','latex'); But I can not make the axis numbers bold, set(gca,'fontweight','bold') doesn't work. Does anybody know how to solve this problem?

採用された回答

Jan
Jan 2018 年 6 月 21 日
編集済み: Jan 2018 年 6 月 21 日
With the LaTeX interpreter you need to define the label as '{\boldmath$\alpha$}' to get a bold face font.
[EDITED]:
axesH = gca;
axesH.XAxis.TickLabelInterpreter = 'latex'
axesH.XAxis.TickLabelFormat = '\\textbf{%g}';
Two \ are required, because at first sprintf is applied and then the LaTeX interpreter.
  2 件のコメント
Red Li
Red Li 2018 年 6 月 21 日
It does not work. The label font is already bold. Further I want the axes numbers bold. Here are my code:
tt = 0:.01:5;
y1 = sin(pi*tt);
y2 = cos(pi*tt);
figure
p1 = plot(tt,y1,'linewidth',1.5); grid on, hold on
p2 = plot(tt,y2,'linewidth',1.5);
set(gca,'TickLabelInterpreter','latex');
set(gca,'fontweight','bold','fontsize',12) % This line I want to make axes number bold
legend([p1 p2],{'\textbf{Sin}','\textbf{Cos}'},'fontsize',12,'interpreter','latex','location','northeast')
xlabel('\bf{Time [sec]}','fontsize',14,'interpreter','latex')
ylabel('\bf{Amplitude [m]}','fontsize',14,'interpreter','latex')
Jan
Jan 2018 年 6 月 21 日
"It does not work" is not a useful explanation of what's going wrong. I do not see how you tried to implement my suggestion.
The bold-face of the axes' font weight are applied only if the text interpreter is set to 'none':
set(gca,'TickLabelInterpreter','none');
set(gca,'fontweight','bold','fontsize',12);
For an example with LaTeX see [EDITED] in my answer.

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

その他の回答 (1 件)

Abdulrahman BIN Rabiah
Abdulrahman BIN Rabiah 2019 年 2 月 14 日

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by