Only the ylabel does not change to latex interpreter
28 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MWolf
am 26 Apr. 2021
Kommentiert: Star Strider
am 26 Apr. 2021
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

0 Kommentare
Akzeptierte Antwort
Star Strider
am 26 Apr. 2021
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

