How to change color of individual bar graph.

4 ビュー (過去 30 日間)
Triveni
Triveni 2016 年 7 月 9 日
コメント済み: Priscil23 2018 年 2 月 5 日
y = [21000 65000 65000 65000 ; 16000 50000 50000 50000 ; 11000 34000 34099 34101; 6299 19500 19299 19300; 7701 37899 37901 37801];
bar(y);
ylabel('Y-data')
xlabel('X-data')
audit = {'audit1' 'audit2' 'audit3' 'audit4'};
legend(audit,'location','northeast')
I want to set color of all 4 different bars(audit1,...) manually.

採用された回答

KSSV
KSSV 2016 年 7 月 9 日
clc; clear all ;
y = [21000 65000 65000 65000 ; 16000 50000 50000 50000 ; 11000 34000 34099 34101; 6299 19500 19299 19300; 7701 37899 37901 37801];
bar_handle = bar(y,'grouped');
set(bar_handle(1),'FaceColor','r') ;
set(bar_handle(2),'FaceColor','b') ;
set(bar_handle(3),'FaceColor','y') ;
set(bar_handle(4),'FaceColor','g') ;
ylabel('Y-data')
xlabel('X-data')
audit = {'audit1' 'audit2' 'audit3' 'audit4'};
legend(audit,'location','northeast')
  1 件のコメント
Priscil23
Priscil23 2018 年 2 月 5 日
Sir, I've learnt it the sameway as you've shown here but assigning colors individually for the bars like you've shown has never worked for me. Kindly, help me out.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by