フィルターのクリア

How to write x-ticks in latex.

42 ビュー (過去 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 Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by