Matplotlib函数之间的填充

2024-04-20 14:29:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我在matplotlib的sentdex教程中看到了fill\u between的用法。 密码就像

import matplotlib.pyplot as plt

axis=plt.subplot2grid((1,1),(0,0)) #a and b are lists of equal sizes
axis.plot(a,b)
axis.fill_between(a,b,34,where=(b>34),facecolor='r',alpha=.5)

现在他的代码运行良好,他在输出中得到的是b中的值大于34的部分的彩色面。 但我也有同样的错误:

TypeError: '>' not supported between instances of 'list' and 'int'

我找不到如何使用where功能


Tags: andofimport密码用法matplotlibas教程