How can we create poll-like plots with confidence intervals like the example attached?
2 views (last 30 days)
Wolfgang McCormack on 6 Jun 2021
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.
Star Strider on 6 Jun 2021
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).
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);
scatter(t, y, 5, 'b', 'filled')
plot(t, solidline, '-r')
patch([t, fliplr(t)], [(solidline-stdev) fliplr(solidline+stdev)], [1 1 1]*0.6, 'FaceAlpha',0.25, 'EdgeColor','none')