Change font style in yyaxis subplots

7 views (last 30 days)
Henrik Schädlich
Henrik Schädlich on 23 Nov 2017
Commented: Henrik Schädlich on 23 Nov 2017
I would like to change the label font to latex style. But somehow the style does not change for the yaxis in the subplots. Any advice. Best regards Henrik
See the code. data attached.
Aktor = importdata(['Aktor1.w_l']);
Aktor_freq = Aktor(:,1);
Aktor_ampl = Aktor(:,2);
Aktor_phase = Aktor(:,3);
Aktor_length = length(Aktor(:,1));
fig = figure (1);
set(fig, 'Units', 'normalized', 'Position', [0.2, 0.1, 0.5, 0.3]);
%%Plot Ampl- und Phasengang
ax1 = subplot(121)
x1 = Aktor_freq;
xlim([Aktor(1,1) Aktor(Aktor_length,1)]);
xlabel('Frequenz in Hz', 'FontSize', 12,'interpreter','latex');
y11 = Aktor_ampl;
y12 = Aktor_phase;
yyaxis left
semilogy(x1,y11,'LineWidth',1.5);
ylabel('Admittanz in S', 'FontSize', 12,'interpreter','latex');
grid on
yyaxis right
plot(x1,y12,'LineWidth',1.5);
ylabel('Phase in °', 'FontSize', 12,'interpreter','latex');
%%Imaginär und Realteil
ax2 = subplot(122);
x2 = Aktor_ampl.*cos(deg2rad(Aktor_phase));
y21 = Aktor_ampl.*sin(deg2rad(Aktor_phase));
plot(x2,y21,'LineWidth',1.5);
xlabel('Realteil', 'FontSize', 12,'interpreter','latex');
ylabel('Imaginärteil', 'FontSize', 12,'interpreter','latex');
grid on;
print('-dpng', ['Amp und Phase Aktor' num2str(iAktor) '.png'], '-r500');
end
  4 Comments
Jan
Jan on 23 Nov 2017
@Henrik: Very nice! When the latex interpreter fails, the text is displayed without interpretation and this changes the font also. Do you get a warning message in the command window? If not, it is worth to send an enhancement request to MathWorks.
Henrik Schädlich
Henrik Schädlich on 23 Nov 2017
Yes, there is an error message.
Warning: Error updating Text.
Character vector must have valid interpreter syntax:
Phase in °
> In defaulterrorcallback (line 12)
In print (line 36)
In Auswertung (line 118)
Warning: Error updating Text.
Character vector must have valid interpreter syntax:
Imaginärteil von $\underline{Y}$
> In defaulterrorcallback (line 12)
In print (line 36)
In Auswertung (line 118)
>>

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!