-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path30000hours.py
31 lines (24 loc) · 1.11 KB
/
30000hours.py
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
import matplotlib.pyplot as plt
# Generated by chatgpt
# Data from the user
names = ["Donald Knuth", "Rob Pike", "Peter Norvig", "Stephen Wolfram", "Lars Bak"]
hours = [56000, 30000, 30000, 50000, 30000]
github_ids = ["", "robpike", "norvig", "", "larsbak"]
# Creating the bar chart without GitHub IDs but with actual hours displayed
plt.figure(figsize=(10, 6))
bars = plt.bar(names, hours, color='skyblue')
plt.xlabel('Programmer')
plt.ylabel('Hours Practiced')
plt.title('Hours Practicing Programming by Accomplished Programmers')
plt.xticks(rotation=45)
plt.ylim(0, 60000)
# Adding the actual hours as labels on the bars
for bar in bars:
yval = bar.get_height()
plt.text(bar.get_x() + bar.get_width()/2, yval, f'{yval}', ha='center', va='bottom', fontsize=9)
# Adding source link and description
description = ("Source Note: Data sourced from personal communications in 2013, asking programmers to estimate "
"their practice hours. Full article at: https://breckyunits.com/30000hours.html")
plt.figtext(0.5, .1, description, ha='center', va='bottom', fontsize=8, wrap=True)
plt.tight_layout()
plt.show()