フィルターのクリア

How can I use an interpreter (like LaTeX) when setting axis markers?

481 ビュー (過去 30 日間)
Mark
Mark 2015 年 6 月 5 日
コメント済み: Himanshu Giria 2022 年 7 月 22 日
I essentially have a contour plot on which I'd like to label each row and column. I can do this with text, but I would like to use the LaTeX formatting instead. So instead of labeling something 'a', I would like to label it '$\alpha_x$'. If I was doing an axis label, I know that the following works:
xlabel('$\alpha_x$','interpreter','latex')
and would like to do something similar for the axis markers. Here's what I have so far:
figure
set(gcf,'color','white')
[X,Y] = meshgrid(0.5:5.5);
Z = X.^2+ Y.^2
pcolor(X,Y,Z);
list = ['a'; 'b'; 'c'; 'd'; 'e'];
set(gca,'XLim',[.5 5.5]);
set(gca,'XTick',[1:5]);
set(gca,'XTickLabel',list)
set(gca,'YLim',[.5 5.5]);
set(gca,'YTick',[1:5]);
set(gca,'YTickLabel',list)
colorbar
If possible I'd also like to make the ticks themselves invsible, but that is a tertiary goal. Writing:
set('gca','YTicklabel',list,'interpreter','latex')
produces the error:
Error using set
Invalid property found.
Object Name: axes
Property Name: 'interpreter'.

採用された回答

Mike Garrity
Mike Garrity 2015 年 6 月 5 日
I assume that by "marker" you mean "ticklabel"? If so, it is separate from the interpreter which is used for titles and labels. In R2014a or earlier, you didn't have control over this interpreter. It was chosen automatically.
In R2014b, there's a new property on the Axes named TickLabelInterpreter which lets you control it.
set(gca,'TickLabelInterpreter','latex')
  3 件のコメント
Stephen23
Stephen23 2015 年 6 月 6 日
Read about the properties XTick, YTick and ZTick:
And then try the (empty) vector []
Les Beckham
Les Beckham 2015 年 6 月 6 日
Try the TickLength property of the axes. set(gca, 'TickLength', [0 0]) eliminates the ticks.

サインインしてコメントする。

その他の回答 (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