【问题标题】:How do I color part of a graph under a line in MATLAB?如何在MATLAB中的一条线下为图形的一部分着色?
【发布时间】:2010-12-07 08:18:18
【问题描述】:

我想在同一个图中有一个线图和彩色线下方的部分图形(置信区间)。

如何在 MATLAB 中做到这一点?

我已经尝试了以下方法,但它不起作用(它只显示区域):

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

【问题讨论】:

    标签: matlab plot area


    【解决方案1】:

    您需要使用 hold off 和 hold on 来保留图中的当前图形。

    像这样:

    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

    【讨论】:

      猜你喜欢
      • 2017-02-24
      • 2014-11-08
      • 1970-01-01
      • 2014-07-02
      • 1970-01-01
      • 2017-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多