如何使用pyplot填充阶梯曲线下的面积?

时间:2017-11-03 21:17:48

标签: python-3.x matplotlib plot

我使用pyplot.step()绘制了两条阶梯曲线,我想在这些曲线下方的区域中遮蔽(理想情况下使用透明阴影)。 pyplot.fill_between()假设线性插值,而我想看到步进插值,如下所示:enter image description here

如何遮盖这些曲线下方的区域?透明着色会很棒,因为这可以清楚地表明这些曲线重叠的位置。

1 个答案:

答案 0 :(得分:10)

您可以使用fill_between的alpha值使其半透明。

public function object()
{
    return $this->belongsTo('App\Object', 'foreign_id');
}

enter image description here