How to assign lables of box plot
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I have below data:
A B C 1 3 5 12 23 56 12 15 26 18 28 23 19 29 27 25 33 46
I want to get the box plot, and assign each plot name as (A,B,C)
Dataset: 1 3 5 12 23 56 12 15 26 18 28 23 19 29 27 25 33 46
xlabels: {'A' 'B' 'C'}
ylables: {'ObservedData'}
My code: boxplot(dataset) ylabel('ylables') xlabel('xlables') But, I can get the xlables (as A, B, C)
댓글 수: 0
채택된 답변
Star Strider
2018년 4월 7일
Try this:
Dataset = [ 1 3 5
12 23 56
12 15 26
18 28 23
19 29 27
25 33 46];
xlabels = {'A' 'B' 'C'};
ylabels = {'Observed Data'};
figure
boxplot(Dataset)
ylabel(ylabels)
set(gca, 'XTickLabel',xlabels)
댓글 수: 2
Star Strider
2018년 4월 13일
It should work, although sometimes it is necessary to specify the 'XTick' values as well.
I am using R2018a. This should work for R2012:
figure
boxplot(Dataset)
ylabel(ylabels)
xt = get(gca, 'XTick');
set(gca, 'XTick',xt, 'XTickLabel',xlabels)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Point Grey Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!