필터 지우기
필터 지우기

How to write x-ticks in latex.

조회 수: 54 (최근 30일)
Atom
Atom 2022년 11월 8일
답변: Star Strider 2022년 11월 8일
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')

채택된 답변

Star Strider
Star Strider 2022년 11월 8일
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개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by