-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpretty_pics.py
More file actions
43 lines (41 loc) · 1.35 KB
/
pretty_pics.py
File metadata and controls
43 lines (41 loc) · 1.35 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import matplotlib.pyplot as plt
import utils
figures = [
"FIGURE",
("cape_town_preci.csv.gz", utils.daily, "k", "Precipitation", "Daily",
"Rainfall"),
"LEGEND",
"FIGURE",
("cape_town_min_t.csv.gz", utils.daily, "b", "Min temp", "Daily", "Temp"),
("cape_town_max_t.csv.gz", utils.daily, "r", "Max temp", "Daily", "Temp"),
"LEGEND",
"FIGURE",
("cape_town_preci.csv.gz", utils.yearly, "k", "Precipitation", "Yearly",
"Rainfall"),
"LEGEND",
"FIGURE",
("cape_town_min_t.csv.gz", utils.yearly, "b", "Min temp", "Yearly",
"Temp"),
("cape_town_max_t.csv.gz", utils.yearly, "r", "Max temp", "Yearly",
"Temp"),
"LEGEND",
]
for average_data in [False, True]:
for f in figures:
if f == "FIGURE":
name = ""
fig, ax = plt.subplots()
continue
if f == "LEGEND":
ax.legend()
if average_data:
name += "Averaged"
plt.savefig("./png/" + name + '.png', bbox_inches='tight')
continue
(filename, func, col, label, xlabel, ylabel) = f
name += label + xlabel
(xs, ys) = utils.get_data(func, filename)
print(filename, len(xs))
if average_data:
(xs, ys, counts) = utils.average(xs, ys)
utils.beautiful_plot(xs, ys, ax, col, label, xlabel, ylabel)