make a grouped bar graph with individual data points and std error bars inside the bars
Show older comments
Dear Matlab,
I have delta and theta power spectrum data for 2 groups of participants. Control group N=11. Patient group N=6 (total 17 subjs).
GOAL: to make a bar graph with:
- individual data points and
- std error bars within the bars.
- I would also like to group them into 2 x-ticks (one for delta, one for theta [each with 2 bars for (1) controls and (2) patients])
- and also delta and theta to each be a different color
IDEAL GRAPH: something very similar to:
What I have to far, please see attached bar graph in standard blue.
I have attached sample data as well. columns 1,3 = controls. columns 2,4 = patient group.
Below is code I have so far:
% load SampleData
figure(8),clf, hold on
b1 = bar([1 2 3 4],mean(logbar,'Omitnan'));%,'FaceColor',[.7 .3 .9]);
errorbar([1,2,3,4],mean(logbar,'Omitnan'),std(logbar,[],'omitnan')/sqrt(17-1),'k.','LineWidth',1);
set(gca,'XTickLabel',{'Delta:Ctrl'; 'Delta:Dra';'Theta:Ctrl'; 'Theta:Dra'},'xtick',[1 2 3 4],'fontweight','bold')
ylabel('Relative Power (dB)','fontweight','bold','fontsize',11)
Thank you so much for any help and time, as always!
Best,
Joanne
1 Comment
Accepted Answer
More Answers (0)
Categories
Find more on Errorbars in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
