【问题标题】:Filling the area between three curves in MatLab with Bold Plot用粗体图填充 MatLab 中三条曲线之间的区域
【发布时间】:2015-06-07 18:32:39
【问题描述】:

我正在尝试制作类似于下图的图表:

我有图表的下限、中位数(粗线)和上限。我尝试使用填充,但它似乎创建了奇怪的填充多边形。另外,如何使中值图加粗?

谢谢。

编辑:这是一个 MWE 试图为曲线 y=1/x 绘制这样的图形。

x=1:1:20
y1 = 1./x
y2 = 1./x-2
y3 = 1./x+2
fill(x,y2,'b',x,y1,'b',x,y3,'b')

【问题讨论】:

  • patch函数和plot函数的'LineWidth'参数。

标签: matlab plot matlab-figure


【解决方案1】:

shadedplot.m 非常适合这样的应用程序。

试试这个:

shadedplot(x, y2, y3, [0.8 0.8 1], [0.8 0.8 1])
hold on
plot(x, y1, 'Color', [0.3 0.3 0.8], 'Linewidth', 3)

【讨论】:

  • 效果很好!谢谢。