format the x-axis in a boxplot

조회 수: 31 (최근 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