how to set x-axis and y-axis of a plot as log scales in bold with latex interpreter?

40 ビュー (過去 30 日間)
SismoPlotter
SismoPlotter 2022 年 2 月 9 日
移動済み: madhan ravi 2023 年 11 月 17 日
I would like to set the axis numbers of a plot in bold in latex font using the log scale.
I can set the axis numbers bold in latex font, but without using the log scale. When using the log scale setting, the bold setting is not taken into account.
ax = gca;
ax.XAxis.TickLabelInterpreter = 'latex';
ax.XAxis.TickLabelFormat = '\\textbf{%g}';
ax.XAxis.Scale = 'log';
Here is the code I am trying to use.

回答 (2 件)

Yongjian Feng
Yongjian Feng 2022 年 2 月 9 日
How about these:
ax = gca;
ax.XAxis.FontWeight='bold';
ax.XAxis.Scale = 'log';
  3 件のコメント
Yongjian Feng
Yongjian Feng 2022 年 2 月 9 日
You don't need latex if you do it this way. Follow my suggestion above.
SismoPlotter
SismoPlotter 2022 年 2 月 9 日
But then, do you have a way to convert the font into latex? Sorry if there was some misunderstanding, but the latex font is a requirement for me.

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


Thomas Ferriday
Thomas Ferriday 2023 年 11 月 17 日
移動済み: madhan ravi 2023 年 11 月 17 日
I had the same issue. A temporary solution (far from robust) is to specify the names on the x- or y-axis as such:
set(gca,'YTick',[1 2 3],'YTickLabel',{'\bfseries{1}','\bfseries{2}','\bfseries{3}'}...
,'FontSize',17,'FontName','Times','FontAngle','Italic'...
,'TickLabelInterpreter','Latex','FontWeight','Bold')
Not the most elegant solution, but it works.

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by