"\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 views (last 30 days)
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.

Accepted Answer

Steven Lord
Steven Lord on 22 Nov 2022
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';

More Answers (0)

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!