Plot of confidence interval with fill

30 ビュー (過去 30 日間)
Orongo
Orongo 2018 年 10 月 21 日
コメント済み: Orongo 2018 年 10 月 23 日

Hi, I have a confidence interval (CI) I would like to plot together with its average. I have used the command fill to create the grey CI area and don't get the results that I want. My data is

mu_diff
0.004228176
-0.000889339
-0.016775836
-0.023576712
-0.041489385
-0.050768254
-0.621729693
-0.634756996
-0.640305162
-0.648905396
CI	
0.004041487	0.004414864
-0.001080781	-0.000697896
-0.016971981	-0.016579692
-0.023777484	-0.02337594
-0.041694683	-0.041284086
-0.050977948	-0.050558559
-0.621943623	-0.621515762
-0.634974968	-0.634539023
-0.640526947	-0.640083377
-0.649130726	-0.648680066

and the lines I have written are

x_axis = 61:70;
x_plot =[x_axis, fliplr(x_axis)];
y_plot=[CI(:,1)', flipud(CI(:,2))'];
hold on
plot(x_axis, mu_diff, 'black', 'linewidth', 1)
fill(x_plot, y_plot, 1,'facecolor', 'red', 'edgecolor', 'none', 'facealpha', 0.4);
hold off

and this is the result

Clearly this is not correct. What is going wrong here?

採用された回答

jonas
jonas 2018 年 10 月 23 日
編集済み: jonas 2018 年 10 月 23 日
Nothing wrong, you just happen to have very narrow confidence bounds.
  1 件のコメント
Orongo
Orongo 2018 年 10 月 23 日
Thanks for that :) I found the magnifier glass too, will be using it from now on.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by