【发布时间】:2020-10-17 05:23:17
【问题描述】:
Ages = [19,20,21,22,23,24,25,26,27]
python = [23000,30000,40000,50000,60000,70000,80000,90000,100000]
Java = [15000,20000,25000,35000,40000,50000,90000,100000,300000]
pl.plot(Ages,python,label="Python developer")
pl.plot(Ages,Java,label="Java developer")
pl.fill_between(Ages,python,Java,where= (python > Java), alpha=0.5, color="blue" , label="greater than")
pl.fill_between(Ages,python,Java,where= (python < Java), alpha=0.5, color="red" , label="less than")
pl.title("Fill area on line plots")
pl.legend(loc="upper left")
pl.show()
我收到弃用警告,当 python 值小于 Java 值时,我也没有得到红色边距。下面我提到了错误和输出屏幕截图...
错误:
matplot.py:143: MatplotlibDeprecationWarning: The parameter where must have the same size as x in fill_between(). This will become an error in future versions of Matplotlib.
pl.fill_between(Ages,python,Java,where= (python > Java), alpha=0.5, color="blue" , label="greater than")
matplot.py:144: MatplotlibDeprecationWarning: The parameter where must have the same size as x in fill_between(). This will become an error in future versions of Matplotlib.
pl.fill_between(Ages,python,Java,where= (python < Java), alpha=0.5, color="red" , label="less than")
输出:
【问题讨论】:
标签: python matplotlib