How to patch upperbound and lowerbound

1 次查看(过去 30 天)
I read about patch to fill in the confidence interval
But I am not yet sure of how it works. (Partly due to the fact that https://www.mathworks.com/help/matlab/ref/patch.html only has graphic examples.)
Suppose I have
plot(T.date,upperbound)
hold on
plot(T.date,lowerbound)
Then how can one fill in upperbound and lowerbound?

采纳的回答

Star Strider
Star Strider 2021-8-23
Try something like this —
T = table(datetime('now')+days(1:14).', rand(14,1), rand (14,1)+1, 'VariableNames',{'date','lowerbound','upperbound'})
T = 14×3 table
date lowerbound upperbound ____________________ __________ __________ 24-Aug-2021 15:54:18 0.3007 1.7723 25-Aug-2021 15:54:18 0.68026 1.703 26-Aug-2021 15:54:18 0.4398 1.6127 27-Aug-2021 15:54:18 0.62549 1.237 28-Aug-2021 15:54:18 0.44381 1.6517 29-Aug-2021 15:54:18 0.71737 1.3115 30-Aug-2021 15:54:18 0.41553 1.1505 31-Aug-2021 15:54:18 0.56936 1.405 01-Sep-2021 15:54:18 0.064302 1.329 02-Sep-2021 15:54:18 0.85725 1.5955 03-Sep-2021 15:54:18 0.15449 1.7525 04-Sep-2021 15:54:18 0.91195 1.8573 05-Sep-2021 15:54:18 0.10671 1.4731 06-Sep-2021 15:54:18 0.41436 1.6558
figure
patch([T.date; flipud(T.date)], [T.lowerbound; flipud(T.upperbound)], 'r', 'FaceAlpha',0.5)
grid
The patch function until recently did not work with datetime arrays, so it was necessary to use fill instead, with the same syntax as demonstrated here.
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polygons 的更多信息

标签

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by