Borrar filtros
Borrar filtros

Bar graph standard deviation

5 visualizaciones (últimos 30 días)
RP
RP el 25 de Mayo de 2019
Comentada: dpb el 25 de Mayo de 2019
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 comentario
dpb
dpb el 25 de Mayo de 2019
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...

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Bar Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by