I have a plot:
x = [0 1 2 3];
y = [0 0 1 1];
plot (x, y, 'k');
I want to use labels at X-axis, and it works:
set(gca,'XTick',[0:3]) % This automatically sets
labels = ['0'; 'T'; 'T'; '1';];
set(gca,'XTickLabel',labels)
However, when I change T to T0. It doesn’t work.
Q1: What are the valid strings of XTickLabel?
Q2: How can I use strings like T0, T1. Or is that possible to use characters with subindex like $A_2$ in latex format.
If you want to set strings of different lengths, you need to use cell arrays, i.e.
will work.
If you want to use Latex to format tick labels, you’ll need to download a function from the Matlab File Exchange.