format the x-axis in a boxplot

1 次查看(过去 30 天)
Seldeeno
Seldeeno 2017-8-22
回答: KL 2017-8-24
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);

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Industrial Statistics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by