Shade area between two lines on a plot - max., and min., values
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Edward Keavney
am 4 Aug. 2022
Beantwortet: Star Strider
am 4 Aug. 2022
Hi,
I have three arrays, each 1X106 corresponding to the max., min., and mean values of a dataset.
See attached image. I would lie to be able to shade the area between the two dotted blue lines (the max. and min. values).
Any help would be greatly appreciated,
Thanks in advance!![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1088115/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1088115/image.png)
0 Kommentare
Akzeptierte Antwort
Star Strider
am 4 Aug. 2022
It would help to have the data.
x = linspace(0, 110).'; % Entire Code Assumes Column Vectors
y1 = randn(size(x))/100 + 0.1;
y1d = 0.01*[-1 1] + y1;
y2 = randn(size(x))/100 + 0.01;
y2d = 0.01*[-1 1] + y2;
figure
plot(x, y1, '-b')
hold on
plot(x, y2, '-r')
patch([x; flip(x)], [y1d(:,1); flip(y1d(:,2))], 'b', 'EdgeColor','b', 'LineStyle','--', 'FaceAlpha',0.25)
patch([x; flip(x)], [y2d(:,1); flip(y2d(:,2))], 'r', 'EdgeColor','r', 'LineStyle','--', 'FaceAlpha',0.25)
hold off
Make appropriate changes to get the result you want.
.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots 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!