Make a plot with gradient shaded confidence intervals
Dear all,
I would like to fill the red shaded area in the plot below using a gradient fill (ideally with a jet colormap), so that the area between the blue line and the upper red dashed line goes from red to blue and the area between the blue line and the lower red dashed line goes from red to blue.
x = Data(:,1);
y = Data(:,2);
y10 = Data(:,3);
y90 = Data(:,4);
figure
plot(x, y, ‘b’, ‘LineWidth’, 2);
hold on;
plot(x, y10, ‘–r’);
plot(x, y90, ‘–r’);
fill([x; flipud(x)], [y10; flipud(y90)], ‘r’,…
‘FaceAlpha’, 0.1, ‘EdgeColor’, ‘none’);
hold off;
legend(‘Median’, ’10th-90th Percentiles’, ‘Location’, ‘best’);
grid on;
Just to give an idea, something like this (without color steps but with a gradient fill):
I have tried myself, but I can’t really find a nice (and fast) solution.
I have attched the Data file.
Any help would be grately appreciated!Dear all,
I would like to fill the red shaded area in the plot below using a gradient fill (ideally with a jet colormap), so that the area between the blue line and the upper red dashed line goes from red to blue and the area between the blue line and the lower red dashed line goes from red to blue.
x = Data(:,1);
y = Data(:,2);
y10 = Data(:,3);
y90 = Data(:,4);
figure
plot(x, y, ‘b’, ‘LineWidth’, 2);
hold on;
plot(x, y10, ‘–r’);
plot(x, y90, ‘–r’);
fill([x; flipud(x)], [y10; flipud(y90)], ‘r’,…
‘FaceAlpha’, 0.1, ‘EdgeColor’, ‘none’);
hold off;
legend(‘Median’, ’10th-90th Percentiles’, ‘Location’, ‘best’);
grid on;
Just to give an idea, something like this (without color steps but with a gradient fill):
I have tried myself, but I can’t really find a nice (and fast) solution.
I have attched the Data file.
Any help would be grately appreciated! Dear all,
I would like to fill the red shaded area in the plot below using a gradient fill (ideally with a jet colormap), so that the area between the blue line and the upper red dashed line goes from red to blue and the area between the blue line and the lower red dashed line goes from red to blue.
x = Data(:,1);
y = Data(:,2);
y10 = Data(:,3);
y90 = Data(:,4);
figure
plot(x, y, ‘b’, ‘LineWidth’, 2);
hold on;
plot(x, y10, ‘–r’);
plot(x, y90, ‘–r’);
fill([x; flipud(x)], [y10; flipud(y90)], ‘r’,…
‘FaceAlpha’, 0.1, ‘EdgeColor’, ‘none’);
hold off;
legend(‘Median’, ’10th-90th Percentiles’, ‘Location’, ‘best’);
grid on;
Just to give an idea, something like this (without color steps but with a gradient fill):
I have tried myself, but I can’t really find a nice (and fast) solution.
I have attched the Data file.
Any help would be grately appreciated! plotting, plot, colormap, graph, graphics, matlab MATLAB Answers — New Questions