Bar graph standard deviation

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');

1 个评论

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...

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Discrete Data Plots 的更多信息

提问:

RP
2019-5-25

评论:

dpb
2019-5-25

Community Treasure Hunt

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

Start Hunting!

Translated by