format the x-axis in a boxplot

1 view (last 30 days)
Seldeeno
Seldeeno on 22 Aug 2017
Answered: KL on 24 Aug 2017
Hi,
I am trying to format my x-axis in an boxplot such that part of an xtick appears with superscript and italic. So far its not working. Any help plz?
a1=xlsread('a1.xlsx','50D','L2:L52');
a2=xlsread('a2.xlsx','50D','L2:L52');
a3=xlsread('a3.xlsx','50D','L2:L52');
a3_2=xlsread('a3_2.xlsx','50D','L2:L52');
a3_3=xlsread('a3_3.xlsx','50D','L2:L52');
a3_4=xlsread('a3_4.xlsx','50D','L2:L52');
a5=xlsread('a5.xlsx','50D','L2:L52');
a4=xlsread('a4.xlsx','50D','L2:L52');
all=[a1; a2; a3; a3_2; a3_3; a3_4; a4; a5];
set(0,'DefaultAxesFontName', 'Arial');
set(0,'DefaultAxesFontSize', 8);
g = [repmat({'a1'}, length(a1), 1); repmat({'a2'}, length(a2), 1); repmat({'a3'},length(a3), 1);repmat({'a3_2'}, length(a3_2), 1);repmat({'a3_3'}, length(a3_3), 1); repmat({'a3_4'}, length(a3_4), 1); repmat({'a4'}, length(a4), 1); repmat({'a5'}, length(a5), 1)];
set(gca,'TickLabelInterpreter','latex');
set(gca,'XTickLabel',{'a1', 'a2', 'a3', 'a3_2', 'a3_3', 'a3_4','a4','Da\itSin-\rmDE+α^{*}'});
boxplot(all,gca,'symbol','bo','width',0.5);

Answers (1)

KL
KL on 24 Aug 2017
set(gca,'FontAngle', 'italic') %for italics
set(gca,'XTickLabel',{'$$a3_{1}$$','$$a3_{2}$$'}); %for subscripts

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!