Attach the figure as an image so don't have to download to see it...attaching sufficient data so folks could reproduce a figure with the problem would likely lead to more people trying than having to build something on their own as well...
Bar graph standard deviation
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I have a problem with a bar graph: as soon as I add standard deviations, the bars disappear and I only see the deviations or nothing at all. This is not the case for all bars in the plot. The code looks like this and works fine when I only run everything until "hold on". I checked the variables that go into the plot and they are all fine, no NaN or similar. I attached the plot so you know what I mean. Thanks a lot in advance for any tips!
subplot(2,2,1)
bar_vivid.prepost = [mean_vivid.pre.(sprintf('s%d',subject)),mean_vivid.post.(sprintf('s%d',subject))];
conditions = categorical({'Pre test','Post test'});
conditions = reordercats(conditions,{'Pre test','Post test'});
bar(conditions,bar_vivid.prepost,'FaceColor',[0.9255 0.9059 0.3647],'LineStyle','none');
ylim([3 5.1])
ylabel('Vividness');
hold on;
SD_Vpre = std(vivid.pre.(sprintf('s%d',subject)),'omitnan');
SD_Vpost = std(vivid.post.(sprintf('s%d',subject)),'omitnan');
all_SDV1 = [SD_Vpre; SD_Vpost];
errorbar(conditions,bar_vivid.prepost,all_SDV1,'k','LineStyle','none');
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!