Skip to content

Commit e4df69e

Browse files
committed
Clarified the bar chart plotting code
1 parent df2e438 commit e4df69e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

ev_counts.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,16 @@
4343

4444
import matplotlib.pyplot as plt
4545

46-
values = [counts[k] for k in sorted(list(counts.keys()))]
47-
plt.bar(sorted(list(counts.keys())), values,
48-
tick_label=sorted(list(counts.keys())))
46+
year_keys = sorted(list(counts.keys()))
47+
#print(year_keys)
48+
49+
values = [counts[k] for k in year_keys]
50+
#print(values)
51+
52+
plt.bar(year_keys, values, tick_label=year_keys)
4953
plt.show()
5054

5155
# HUOM.! Jos saat ilmoituksen "serWarning: Matplotlib is
5256
# currently using agg, which is a non-GUI backend, so
5357
# cannot show the figure.", niin ratkaisu on
5458
# asentaa Tkinter: `sudo apt-get install python3-tk`
55-
56-
57-
58-
59-
60-

0 commit comments

Comments
 (0)