The parameter problem of matplotlib.fill_between?

follow the code typed in the book, but report an error. Here is to change the date string into an object for fill_between operation. But failed all the time. Ask for advice. The
* file is in csv format, and only the data from the first three fields are manipulated here.

clipboard.png

:
clipboard.png

the code is as follows:
import csv
from matplotlib import pyplot as plt
import datetime

< H1 > get date and maximum and minimum temperature < / H1 >

filename = "sitka_weather_07-2014.csv"
with open (filename) as f:

reader = csv.reader(f)
header_row = next(reader)

dates,highs,lows = [],[],[]
for row in reader:
    current_date =datetime.datetime.strptime(row[0],"%Y/%m/%d")
    dates.append(current_date)
    high=int(row[1])
    highs.append(row[1])
    low = int(row[3])
    lows.append(low)
< H1 > draw graphics < / H1 >

fig = plt.figure (dpi=124,figsize= (10Power6), frameon=1)
plt.plot (dates,highs,c="red",alpha=0.5)
plt.plot (dates,lows,c="blue",alpha=0.5)
plt.fill_between (dates,highs,lows,facecolor="blue",alpha=0.1)

< H1 > format the drawing < / H1 >

plt.title ("Daily temperatures,2014",fontsize=24)
plt.xlabel ("", fontsize=16)
fig.autofmt_xdate ()
plt.ylabel ("Temperatures (F)", fontsize=16)
plt.tick_params (axis="both",which="major",labelsize=10)

plt.show ()

the files used are as follows:

Jul.01,2021

this bug seems to have been solved. Try to upgrade the package

pip3 install -U matplotlib
Menu