Only the ylabel does not change to latex interpreter

35 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Labels and Annotations 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by