如何在matplotlib 3D中的线和函数之间填充?

时间:2018-09-10 19:24:52

标签: python python-2.7 matplotlib

我有一条线和一条函数,我需要在它们之间涂颜色。我该怎么办?

1 个答案:

答案 0 :(得分:0)

您可以使用plt.fill_between并指定一个上限和一个下限,例如:

x = np.arange(100)

plt.figure()
plt.fill_between(x, 2*x, np.sin(x))
plt.show()

enter image description here