Remove the gaps between the bars in matlab without changing the width of the bars

3 views (last 30 days)
Hello,
How can I do that?
clear all,
close all,
Zigma_nohole = [882,873,860];
Zigma_1hole = [523,540,545];
Zigma_2H0 = [393,355,358,352];
Zigma_2H45 = [389,360,365,376];
Zigma_2H90 = [580,540,545,547];
Avg_nohole = mean (Zigma_nohole);
Avg_1hole = mean (Zigma_1hole);
Avg_2H0 = mean (Zigma_2H0);
Avg_2H45 = mean (Zigma_2H45);
Avg_2H90 = mean (Zigma_2H90);
AVG_ALL = [Avg_nohole,Avg_1hole,Avg_2H0,Avg_2H45,Avg_2H90];
std_nohole = std (Zigma_nohole);
std_1hole = std (Zigma_1hole);
std_2H0 = std (Zigma_2H0);
std_2H45 = std (Zigma_2H45);
std_2H90 = std (Zigma_2H90);
STD_ALL = [std_nohole,std_1hole,std_2H0,std_2H45,std_2H90];
y = [ Avg_nohole; Avg_1hole; Avg_2H0; Avg_2H45; Avg_2H90];
bh = bar(1:5,diag(y),0.5,'stacked','FaceColor', 'c');
bh(1).FaceColor = 'r';
bh(2).FaceColor = 'b';
bh(3).FaceColor = 'g';
bh(4).FaceColor = 'k';
bh(5).FaceColor = 'y';
legend('Nohole','1hole','2H0','2H45','2H90')
hold on
h = errorbar(1:5,AVG_ALL,STD_ALL, '.');
ylabel('Tensile Strength (MPa)')
  3 Comments

Sign in to comment.

Answers (1)

Torkan
Torkan on 27 Mar 2021
Could you please share with me? I want to reduce the width actually btw

Community Treasure Hunt

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

Start Hunting!