How do I color a part of the plot below a line in MATLAB?

I would like to have a line graph in the same figure and a part of the graph below the colored (confidence interval) line.

How do I do this in MATLAB?

I've already tried the following but it doesn't work (it only shows the area):

plot(theta, p_prior_cum)
area(theta(50:70), p_prior_cum(50:70))
axis([0  1  0  1])

      

+2


source to share


1 answer


You need to use a hold and hold to keep the current graph in the figure.

Like this:



hold on
plot(theta, p_prior_cum)
area(theta(50:70), p_prior_cum(50:70))
axis([0  1  0  1])
hold off

      

Here is a link that describes the usage in more detail

+10


source







All Articles