MATLAB Answers

How to make ticks labels (the numbers, not the axis labels.) bold when using latex interpreter.

86 views (last 30 days)
Red Li
Red Li on 21 Jun 2018
Answered: Bjorn Gustavsson on 16 Feb 2021
I applied latex interpreter to axis numbers. But I can not make the axis numbers bold, set(gca,'fontweight','bold') doesn't work. The following is 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')
I have already made the axis labels bold. So don't tell me how to do this. Pleas focus on the ticklabels, which are the numbers showing on the x y axis, such as 1,2,3,4...

Community Treasure Hunt

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

Start Hunting!

Translated by