-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhighs_lows.py
More file actions
27 lines (24 loc) · 745 Bytes
/
highs_lows.py
File metadata and controls
27 lines (24 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import csv
from matplotlib import pyplot as plt
from datetime import datetime
filename = 'sitka_weather_2014.csv'
with open(filename) as f:
reader = csv.reader(f)
header_row = next(reader)
highs = []
dates = []
lows = []
for row in reader:
highs.append(int(row[1]))
dates.append(datetime.strptime(row[0],"%Y-%m-%d"))
lows.append(int(row[3]))
fig = plt.figure(dpi = 148,figsize = (10,6))
plt.plot(dates,highs,c='red')
plt.plot(dates,lows,c='blue')
plt.fill_between(dates,highs,lows,facecolor='blue',alpha=0.5)
plt.title("Daily high temperatures, July 2014", fontsize=24)
plt.xlabel('', fontsize=16)
fig.autofmt_xdate()
plt.ylabel("Temperature (F)", fontsize=10)
plt.tick_params(axis='both', which='major', labelsize=10)
plt.show()