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!