Only the ylabel does not change to latex interpreter

25 ビュー (過去 30 日間)
MWolf
MWolf 2021 年 4 月 26 日
コメント済み: Star Strider 2021 年 4 月 26 日
I'm trying to make a plot on the title and both axes are written in the standard Latex font. My problem is however that only the y-label will stay in the standard Matlab font. Does anyone have an idea how to get this y-label in the Latex font just like the x-label and title?
I've also tried:
set(0,'defaulttextinterpreter','latex')
and
set(groot,'defaultAxesTickLabelInterpreter','latex')
without any succes.
The complete plotting code is:
figure(3)
hold on
set(gca,'TickLabelInterpreter','latex')
plot(s_to_ms*0.5*(1:length(avgmeantimeframes(1,:))),s_to_ms*mutopixel*avgmeantimeframes(1,:)/2000,'LineWidth',2.5)
title('Average velocity for different applied pressures','FontSize',12)
ax = gca; % current axes
ax.FontSize = 16;
xlim([0 33000])
ylim([1.6 2])
xlabel('Time [ms]');
ylabel('Average droplet velocity [µ/ms]');
yL = get(gca,'YLim');
line([4500 4500],yL,'Color','#EDB120','LineStyle','--');
line([9500 9500],yL,'Color','#EDB120','LineStyle','--');
line([14500 14500],yL,'Color','#EDB120','LineStyle','--');
line([19500 19500],yL,'Color','#EDB120','LineStyle','--');
line([24500 24500],yL,'Color','#EDB120','LineStyle','--');
line([29500 29500],yL,'Color','#EDB120','LineStyle','--');
text(1000,1.62,'1 Bar','FontSize',12,'FontWeight','bold')
text(5500,1.62,'2 Bar','FontSize',12,'FontWeight','bold')
text(10500,1.62,'2,5 Bar','FontSize',12,'FontWeight','bold')
text(15500,1.62,'3 Bar','FontSize',12,'FontWeight','bold')
text(20500,1.62,'3,5 Bar','FontSize',12,'FontWeight','bold')
text(25500,1.62,'4 Bar','FontSize',12,'FontWeight','bold')
text(30500,1.62,'1 Bar','FontSize',12,'FontWeight','bold')
set(gcf,'position',[600,300,1000,562.5])
hold off
With the following figure as result

採用された回答

Star Strider
Star Strider 2021 年 4 月 26 日
The LaTeX interpreter doesn’t like the ‘µ’.
Try this:
ylabel('$Average droplet velocity [\mu/ms]$', 'Interpreter','latex');
I needed to add the $ and specify the interpreter because I can’t run the code (no data).
  4 件のコメント
MWolf
MWolf 2021 年 4 月 26 日
Thank you, this works!
Star Strider
Star Strider 2021 年 4 月 26 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by