Filter löschen
Filter löschen

How to get different patches (hatches) in my bar graph?

22 Ansichten (letzte 30 Tage)
sanjay Krishnamurthy
sanjay Krishnamurthy am 25 Mär. 2022
Beantwortet: Chunru am 25 Mär. 2022
%% Below is my code, I wanted to get the different patch style for my first (AR,WQ,AC,FC) 4 bar lines. I tried several options and it did not work, can someone help me here.
%% I want to retain the color code too
name = {'AR','WQ','AC','FC','WQ+S','AC+S','FC+S'};
X = [1:7];
%Y = [AreaPk_AR AreaPk_WQ AreaPk_AC AreaPk_FC AreaPk_WQS AreaPk_ACS AreaPk_FCS];
Y = [0.1167 0.01998 0.01872 0.0410 0.4390 0.2141 0.6627]
b = bar(X,Y,0.5)
set(gca,'xticklabels',name)
ylabel('Area below the peak in ')
hold on
b1 = set(bar(X(1), Y(1),0.5,'FaceColor','black'));
hold on
set(bar(X(2), Y(2),0.5,'FaceColor','#0072BD')); %WQ
hold on
set(bar(X(3), Y(3),0.5,'FaceColor','#D95319')); %AC
hold on
set(bar(X(4), Y(4),0.5,'FaceColor','#7E2F8E')); %FC
hold on
set(bar(X(5), Y(5),0.5,'FaceColor','#0072BD')); %WQS
hold on
set(bar(X(6), Y(6),0.5,'FaceColor','#D95319')); %ACS
hold on
set(bar(X(7), Y(7),0.5,'FaceColor','#7E2F8E')); %FCS

Antworten (1)

Chunru
Chunru am 25 Mär. 2022

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by