December 2018
Beginner to intermediate
682 pages
18h 1m
English
Instead of plotting red points (black points) over the closing prices to indicate the upper and lower tenth percentiles, we can use matplotlib's fill_between function. This function fills in all the areas between two lines. It takes an optional where parameter that accepts a boolean Series, alerting it to exactly which locations to fill in:
>>> slb_close.plot(color='black', figsize=(12,6))>>> plt.hlines(y=[lower_10, upper_10], xmin=xmin, xmax=xmax,color='lightgray')>>> plt.fill_between(x=criteria.index, y1=lower_10, y2=slb_close.values, color='black')>>> plt.fill_between(x=criteria.index,y1=lower_10, y2=slb_close.values, where=slb_close < lower_10, color='lightgray')>>> plt.fill_between(x=criteria.index, y1=upper_10, y2=slb_close.values, ...