[英]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? 我怎样才能在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. 您需要使用hold off和hold来保留图中的当前图形。
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 这是一个更彻底地描述用法的链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.