LaTeX interpreter with multiple strings or character vectors
I have a series of values in units of that I want to label on the x-axis using xticklabels(mylabels). I want to typeset the units using LaTeX command. Thus I specified latex as the interpretor for my tick labels using the commands:
ax=gca;
ax.TickLabelInterpreter=’Latex’;
The labels are displayed correctly when I set mylabels as cell array of character vectors as follows:
mylabels={‘$-2pi$’,’$-frac{3pi}{2}$’,’$-pi$’,’$-frac{pi}{2}$’,’0~~~~’,’$frac{pi}{2}$’,’$pi$’,’$frac{3pi}{2}$’,’$2pi$’};
However, when I specify mylabels as a cell array of strings, or a string array, or a character array as follows, the labels are not displayed on the x-axis.
mylabels=[‘$-2pi$’,’$-frac{3pi}{2}$’,’$-pi$’,’$-frac{pi}{2}$’,’0~~~~’,’$frac{pi}{2}$’,’$pi$’,… ‘$frac{3pi}{2}$’,’$2pi$’];
mylabels={"-2pi","-frac{3pi}{2}","-pi","-frac{pi}{2}","0~~~~", "frac{pi}{2}","pi","frac{3pi}{2}","2pi"};
mylabels=["-2pi","-frac{3pi}{2}","-pi","-frac{pi}{2}","0~~~~","frac{pi}{2}","pi","frac{3pi}{2}","2pi"];
I would like to understand what’s the problem here.
A complete MWE is given as follows:
figure;
xlabel("x")
ylabel("y")
xlim([-2*pi 2*pi])
xticks(-2*pi:pi/2:2*pi)
mylabels={‘$-2pi$’,’$-frac{3pi}{2}$’,’$-pi$’,’$-frac{pi}{2}$’,’0~~~~’,’$frac{pi}{2}$’,’$pi$’,’$frac{3pi}{2}$’,’$2pi$’};
xticklabels(mylabels)
ax=gca;
ax.TickLabelInterpreter=’Latex’;
Thank you very much in advance!I have a series of values in units of that I want to label on the x-axis using xticklabels(mylabels). I want to typeset the units using LaTeX command. Thus I specified latex as the interpretor for my tick labels using the commands:
ax=gca;
ax.TickLabelInterpreter=’Latex’;
The labels are displayed correctly when I set mylabels as cell array of character vectors as follows:
mylabels={‘$-2pi$’,’$-frac{3pi}{2}$’,’$-pi$’,’$-frac{pi}{2}$’,’0~~~~’,’$frac{pi}{2}$’,’$pi$’,’$frac{3pi}{2}$’,’$2pi$’};
However, when I specify mylabels as a cell array of strings, or a string array, or a character array as follows, the labels are not displayed on the x-axis.
mylabels=[‘$-2pi$’,’$-frac{3pi}{2}$’,’$-pi$’,’$-frac{pi}{2}$’,’0~~~~’,’$frac{pi}{2}$’,’$pi$’,… ‘$frac{3pi}{2}$’,’$2pi$’];
mylabels={"-2pi","-frac{3pi}{2}","-pi","-frac{pi}{2}","0~~~~", "frac{pi}{2}","pi","frac{3pi}{2}","2pi"};
mylabels=["-2pi","-frac{3pi}{2}","-pi","-frac{pi}{2}","0~~~~","frac{pi}{2}","pi","frac{3pi}{2}","2pi"];
I would like to understand what’s the problem here.
A complete MWE is given as follows:
figure;
xlabel("x")
ylabel("y")
xlim([-2*pi 2*pi])
xticks(-2*pi:pi/2:2*pi)
mylabels={‘$-2pi$’,’$-frac{3pi}{2}$’,’$-pi$’,’$-frac{pi}{2}$’,’0~~~~’,’$frac{pi}{2}$’,’$pi$’,’$frac{3pi}{2}$’,’$2pi$’};
xticklabels(mylabels)
ax=gca;
ax.TickLabelInterpreter=’Latex’;
Thank you very much in advance! I have a series of values in units of that I want to label on the x-axis using xticklabels(mylabels). I want to typeset the units using LaTeX command. Thus I specified latex as the interpretor for my tick labels using the commands:
ax=gca;
ax.TickLabelInterpreter=’Latex’;
The labels are displayed correctly when I set mylabels as cell array of character vectors as follows:
mylabels={‘$-2pi$’,’$-frac{3pi}{2}$’,’$-pi$’,’$-frac{pi}{2}$’,’0~~~~’,’$frac{pi}{2}$’,’$pi$’,’$frac{3pi}{2}$’,’$2pi$’};
However, when I specify mylabels as a cell array of strings, or a string array, or a character array as follows, the labels are not displayed on the x-axis.
mylabels=[‘$-2pi$’,’$-frac{3pi}{2}$’,’$-pi$’,’$-frac{pi}{2}$’,’0~~~~’,’$frac{pi}{2}$’,’$pi$’,… ‘$frac{3pi}{2}$’,’$2pi$’];
mylabels={"-2pi","-frac{3pi}{2}","-pi","-frac{pi}{2}","0~~~~", "frac{pi}{2}","pi","frac{3pi}{2}","2pi"};
mylabels=["-2pi","-frac{3pi}{2}","-pi","-frac{pi}{2}","0~~~~","frac{pi}{2}","pi","frac{3pi}{2}","2pi"];
I would like to understand what’s the problem here.
A complete MWE is given as follows:
figure;
xlabel("x")
ylabel("y")
xlim([-2*pi 2*pi])
xticks(-2*pi:pi/2:2*pi)
mylabels={‘$-2pi$’,’$-frac{3pi}{2}$’,’$-pi$’,’$-frac{pi}{2}$’,’0~~~~’,’$frac{pi}{2}$’,’$pi$’,’$frac{3pi}{2}$’,’$2pi$’};
xticklabels(mylabels)
ax=gca;
ax.TickLabelInterpreter=’Latex’;
Thank you very much in advance! plot, latex interpreter MATLAB Answers — New Questions