Change font style in yyaxis subplots

조회 수: 4 (최근 30일)
Henrik Schädlich
Henrik Schädlich 2017년 11월 23일
댓글: Henrik Schädlich 2017년 11월 23일
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
Jan
Jan 2017년 11월 23일
@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 2017년 11월 23일
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)
>>

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by