"\newline" "\mu" "pi", etc. doesn't work as intended on xticklabel of boxplot. It just prints as it is instead of printing a new line or μ or π.

조회 수: 12 (최근 30일)
Using the above commands doesn't work as intended on xticklabel for boxplot, but works normally for xticklabel for normal plot, or for xlabel or ylabel of normal plot or boxplot. It is just the xticklabel of boxplot that the above commands doesn't work.
For example, having xticklabel(a \mu b), simply prints "a \mu b", instead of "a μ b".
Don't know what's going on. Is this a bug that needs to be reported?
Please help.

채택된 답변

Steven Lord
Steven Lord 2022년 11월 22일
Note that in order for tick labels to be interpreted as TeX or LaTeX the TickLabelInterpreter property needs to be set correctly. The default is 'TeX'. If the TickLabelInterpreter is set to 'none' (which I believe the boxplot function does in case the variables you're trying to plot have names that include characters like underscore) the tick labels won't be interpreted.
figure
load carsmall
boxplot(MPG, Origin)
xticklabels('a \mu b')
ax = gca;
ax.XAxis.TickLabelInterpreter
ans = 'none'
If I create a boxplot and change that property see what happens:
figure
load carsmall
boxplot(MPG, Origin)
xticklabels('a \mu b')
ax = gca;
ax.XAxis.TickLabelInterpreter = 'TeX';

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by