素点を含む棒グラフの作り方

添付画像のような、各被験者ごとの値をプロットで表示した棒グラフはどのように作れるのでしょうか。
初歩的な質問ですみませんが、よろしくお願い致します。

 采纳的回答

swarmchart関数はどうでしょう
x1 = ones(1,50);
x2 = 2 * x1;
y1 = [rand(1,30)*2-1 ones(1,10) -ones(1,10)];
y2 = [rand(1,30)*2-1 ones(1,10) -ones(1,10)];
swarmchart(x1,y1,25,'k','filled','XJitter','rand','XJitterWidth',0.5);
hold on
swarmchart(x2,y2,25,'k','filled','XJitter','rand','XJitterWidth',0.5);
yline(0,'--');
line([0.75,1.25],[mean(y1) mean(y1)],'Color','k');
line([1.75,2.25],[mean(y2) mean(y2)],'Color','k');
hold off

4 个评论

KO
KO 2022-7-13
いつもありがとうございます。
ちなみにver2016aでできる関数はありますでしょうか?
scatter関数でも同じ事が出来ますね
x1 = ones(1,50);
x2 = 2 * x1;
y1 = [rand(1,30)*2-1 ones(1,10) -ones(1,10)];
y2 = [rand(1,30)*2-1 ones(1,10) -ones(1,10)];
scatter(x1+(rand(size(y1))-0.5)/4,y1,30,'k','filled');
hold on
scatter(x2+(rand(size(y2))-0.5)/4,y2,30,'k','filled');
yline(0,'--');
line([0.75,1.25],[mean(y1) mean(y1)],'Color','k');
line([1.75,2.25],[mean(y2) mean(y2)],'Color','k');
hold off
xlim([0.5,2.5]);
ylim([-1,1]);
KO
KO 2022-7-14
いつも本当にありがとうございます。
今後ともよろしくお願いいたします。

请先登录,再进行评论。

更多回答(0 个)

类别

产品

版本

R2016a

标签

Community Treasure Hunt

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

Start Hunting!