Hello there, I know a lot of answers exist for shading the confidence interval between two curves on a plot. However, I am unable to generate it for this data.
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
T
el 17 de Dic. de 2022
Comentada: T
el 18 de Dic. de 2022
I tried a few options from the previous answers
like fill, plotUnc, patch but I only get a very fine
black/grey curves at the upper and lower limits.
I have a mean curve, upper limit curve and
lower limit curve data. I want to show the mean
curve and just shade the area in the confidence
interval without lines.
E.g. the below code gives this :

load('data_ques2.mat')
%X2 = [X, fliplr(X)];
inBetween = [YU, fliplr(YL)];
figure()
patch([X fliplr(X)], [YU fliplr(YL)],'g', 'FaceAlpha',0.5);
%fill(X2, inBetween, 'g');
hold on;
plot(X, YM, 'r', 'LineWidth', 2);
But i would like this:

Could you please help me figure out what am I doing wrong here? Thanks in advance!
TWT
0 comentarios
Respuesta aceptada
Walter Roberson
el 17 de Dic. de 2022
Editada: Walter Roberson
el 17 de Dic. de 2022
Your last YU value is NaN. patch() and fill() can only draw a face when all of the coordinates for the face are finite.
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!