Bound Fill Between Plot Lines
Mostrar comentarios más antiguos
I'm trying to fill between two lines on a plot to create a confidence interval plot around the original data plot. The upper and lower bounds of y have been calculated and exist in 25x1 vectors along with the x and y data. The basic code I have (included below) so far works to an extent, as in it does fill between the lines, however it connects one end of the plot back to the start. I imagine that the data needs bounding in some way as to prevent this, but I am at a complete loss of how to do this. Any help would be greatly appreciated. Thanks.
x_plot = [x_data, fliplr(x_data)];
y_plot = [lower_confidence_band_y, fliplr(upper_confidence_band_y)];
hold on
plot(x, y_data);
fill(x_plot, y_plot);
hold off
1 comentario
Big Bassist 97
el 4 de En. de 2018
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 4 de En. de 2018
0 votos
Maybe try patch() instead of area().
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!