How can we create poll-like plots with confidence intervals like the example attached?

3 ビュー (過去 30 日間)
Hi all,
I have a quick question, does anyone know where we can start for this type of chart below?
It's technically a regression line, confidence interval and actual data based on time. But graphically it looks so appealing.
I appreciate any clue or advice you could provide.
Thanks
  1 件のコメント
dpb
dpb 2021 年 6 月 6 日
The CurveFitting and/or Statistics TB fit function includes LOESS/LOWESS models although I've not (yet) used the MATLAB implementation.
The Signal Processing TB includes an implementation of the underlying Savitsky-Golay filter.
Generating the plots would be adding features with patch() or the like to shade the intervals -- not terribly difficult but can be time-consuming to build.

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

採用された回答

Star Strider
Star Strider 2021 年 6 月 6 日
That would appear to be a scatter plot with mean or median values plotted on it as well (likely using movmean or movmedian), with patch objects providing the shading between the confidence intervals (or something similar).
Example —
t = linspace(1,1000,200);
y = sin(2*pi*t*0.003) + randn(size(t))*0.5;
solidline = movmean(y, 100);
stdev = movstd(y, 100);
figure
scatter(t, y, 5, 'b', 'filled')
hold on
plot(t, solidline, '-r')
patch([t, fliplr(t)], [(solidline-stdev) fliplr(solidline+stdev)], [1 1 1]*0.6, 'FaceAlpha',0.25, 'EdgeColor','none')
hold off
grid
.
  2 件のコメント
Wolfgang McCormack
Wolfgang McCormack 2021 年 6 月 6 日
@Star Strider wow you are my hero, thankssssss!
Star Strider
Star Strider 2021 年 6 月 6 日
Thank you!
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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