Label multiple boxplots in same figure

조회 수: 6 (최근 30일)
aet
aet 2019년 6월 11일
댓글: aet 2019년 6월 11일
I used this code to create a figure with two boxplots. How do I label K and M (on x-axis) as "HC" and "SZ" respectively?? I also would like to name the y-axis "Kurtosis." Thanks in advance!
toget=[K M];
grp=[zeros(1,21),ones(1,19)];
boxplot(toget,grp)

채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 6월 11일
편집: KALYAN ACHARJYA 2019년 6월 11일
As you didnot provided the K and M, so I did not able to cehck my code, this is perfectly works on bar charts, please try and let me know, it working or not?
x_label= {'HC';'SZ'};
toget=[K M];
grp=[zeros(1,21),ones(1,19)];
boxplot(toget,grp)
set(gca,'xticklabel',x_label)
or
boxplot([toget,grp],'Labels',{'HC','SZ'})
  댓글 수: 4
aet
aet 2019년 6월 11일
I don't want the y ticks, I just want the entire axis labeled
aet
aet 2019년 6월 11일
I figured it out. Used ylabel('Kurtosis') and it gave me what I wanted

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by