I have tried https://www.mathworks.com/matlabcentral/answers/180829-shade-area-between-graphs but does not seem to work. Maybe it is because x axis is a datetimie variable?
How to patch upperbound and lowerbound
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
alpedhuez
el 23 de Ag. de 2021
Comentada: Star Strider
el 23 de Ag. de 2021
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?
1 comentario
Respuesta aceptada
Star Strider
el 23 de Ag. de 2021
Try something like this —
T = table(datetime('now')+days(1:14).', rand(14,1), rand (14,1)+1, 'VariableNames',{'date','lowerbound','upperbound'})
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.
.
2 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Polygons en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!