Only the ylabel does not change to latex interpreter

21 vues (au cours des 30 derniers jours)
MWolf
MWolf le 26 Avr 2021
Commenté : Star Strider le 26 Avr 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

Réponse acceptée

Star Strider
Star Strider le 26 Avr 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 commentaires
MWolf
MWolf le 26 Avr 2021
Thank you, this works!
Star Strider
Star Strider le 26 Avr 2021
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Labels and Annotations dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by