How to write x-ticks in latex.
66 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Atom
le 8 Nov 2022
Réponse apportée : Star Strider
le 8 Nov 2022
How to write x-ticks in latex.
I tried with
xticklabels({'x_m','x_2'},'interpreter','latex')
But failed. Please suggest or modify the code so that I can get the desired xticklabels $x_m$ and $x_2$ at x=0.2,0.5 respectively in latex.
plot([.2 .2], [0 .35],'--k')
hold on
plot([.5 .5], [0 .35],'--k')
axis([0 1 0 .35]);
xticks([.2 .5])
xticklabels({'xm','x2'})
xlabel('$x\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
ylabel('$y\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
0 commentaires
Réponse acceptée
Star Strider
le 8 Nov 2022
Try this —
plot([.2 .2], [0 .35],'--k')
hold on
plot([.5 .5], [0 .35],'--k')
axis([0 1 0 .35]);
xticks([.2 .5])
Ax = gca;
Ax.XAxis.TickLabels = {'$x_m$','$x_2$'}; % Changed
Ax.XAxis.TickLabelInterpreter = 'latex'; % Added
xlabel('$x\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
ylabel('$y\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!