Remove the gaps between the bars in matlab without changing the width of the bars
1 次查看(过去 30 天)
显示 更早的评论
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)')
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!