필터 지우기
필터 지우기

How to make a Part a and Part b bar chart

조회 수: 2 (최근 30일)
Sally Weston
Sally Weston 2017년 6월 7일
댓글: Sally Weston 2017년 6월 7일
Hi everyone
I have a set of data that is in a Part A and a Part B style, and I would like to present it in a bar chart. Ideally the category labels would be "Part A" and "Part B", and the bars in Part A would all be one colour and the bars in Part B would all be another colour.
Please help, thanks Sally
So far I have...
Data = [3.13 3.14 3.13 3.13 3.13 3.11 3.12 3.18 3.16 3.16 3.16 3.16 3.15 3.20 3.20;... 3.14 3.14 3.15 3.15 3.18 3.11 3.11 3.11 3.11 3.11 3.12 3.10 3.11 3.12 3.18];
figure b = bar(Data,'grouped');
ylabel('Data')
ylim([3.06 3.22])

답변 (1개)

KSSV
KSSV 2017년 6월 7일
partA = rand(10,1) ;
partB = rand(10,1) ;
bar(1:10,partA, 'r')
hold on
bar(11:20,partB, 'b')
  댓글 수: 1
Sally Weston
Sally Weston 2017년 6월 7일
Thank you, how would you add the category names? so that "partA" covers bars 1:10?

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

카테고리

Help CenterFile Exchange에서 Bar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by