Bar graph standard deviation
3 ビュー (過去 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');
1 件のコメント
dpb
2019 年 5 月 25 日
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 件)
参考
カテゴリ
Help Center および File Exchange で Discrete Data Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!