简体   繁体   中英

How do I color part of a graph under a line in MATLAB?

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

How can I do this in MATLAB?

I 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])

You need to use hold off and hold on to retain 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 more thoroughly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM