Add error bars to grouped bar plot

6 ビュー (過去 30 日間)
michelle bruni
michelle bruni 2019 年 12 月 9 日
回答済み: Star Strider 2019 年 12 月 10 日
I have a simple, grouped bar plot. I want to add error bars, but I can't seem to figure out how to do it. I've tried the errorbar function, but I think I'm missing something.
I'm not really great with for loops, but I was wondering if that would be easier? Not sure how to build one when plotting, though.
Here's my code and graph:
% Plot raw data
x = 1:6
y = [316.45 292.14 319.96; 305.59 287.99 295.21]
err = [13.12 5.67 12.36; 12.43 6.83 11.67]
box on
bar(y)
set(gca,'xticklabel',{'Pre-test'; 'Post-test'})
ylim([200 360])
ylabel('RT (ms)')
xlabel('Session')

回答 (2 件)

Jeremy
Jeremy 2019 年 12 月 9 日
  1 件のコメント
michelle bruni
michelle bruni 2019 年 12 月 10 日
Yes, except I don't know what to put for x=? Because it's grouped, I don't know how to indicate that there are 3 bars per tick (pre-test and post-test).

サインインしてコメントする。


Star Strider
Star Strider 2019 年 12 月 10 日

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by