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()
I am getting deprecation warning & also i didnt get the red margin when python value less than Java value.. Below i have mentioned error & screenshot of output...
Error:
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")
Output:

