Continuous error bar across the x
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all, i want to plot the mean of a data measurment with the standard deviation. I tried using boundedline but it is not working. I have just one value (y value) with the standard error to plot across the x values. can someone know how to do it.
0 Kommentare
Antworten (1)
DGM
am 15 Nov. 2022
What about boundedline doesn't work? If you specify y as a constant-valued vector, I don't see why it wouldn't work.
You could always just use patch() or similar.
% some fake data
x = 0:99; % or whatever x means here
err = 0.5 + 0.2*rand(1,100); % some error
err = smoothdata(err,'movmean',20); % make it smooth for the demo
y = 12.4; % some constant y-level
% boundary curves
yu = y + err;
yl = y - err;
% plot the things
yline(y);
hold on
hp = patch([x fliplr(x)],[yu fliplr(yl)],'b');
hp.FaceAlpha = 0.2;
hp.EdgeAlpha = 0;
plot(x,yu,'k--')
plot(x,yl,'k--')
0 Kommentare
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!