Skip to content

Commit bf5a05f

Browse files
committed
Matplotlib Series Code
1 parent 2d2e572 commit bf5a05f

33 files changed

+167689
-0
lines changed

Diff for: Python/Matplotlib/01-Introduction/finished_code.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
from matplotlib import pyplot as plt
3+
4+
plt.xkcd()
5+
6+
ages_x = [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
7+
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55]
8+
9+
py_dev_y = [20046, 17100, 20000, 24744, 30500, 37732, 41247, 45372, 48876, 53850, 57287, 63016, 65998, 70003, 70000, 71496, 75370, 83640, 84666,
10+
84392, 78254, 85000, 87038, 91991, 100000, 94796, 97962, 93302, 99240, 102736, 112285, 100771, 104708, 108423, 101407, 112542, 122870, 120000]
11+
plt.plot(ages_x, py_dev_y, label='Python')
12+
13+
js_dev_y = [16446, 16791, 18942, 21780, 25704, 29000, 34372, 37810, 43515, 46823, 49293, 53437, 56373, 62375, 66674, 68745, 68746, 74583, 79000,
14+
78508, 79996, 80403, 83820, 88833, 91660, 87892, 96243, 90000, 99313, 91660, 102264, 100000, 100000, 91660, 99240, 108000, 105000, 104000]
15+
plt.plot(ages_x, js_dev_y, label='JavaScript')
16+
17+
dev_y = [17784, 16500, 18012, 20628, 25206, 30252, 34368, 38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752, 77232,
18+
78000, 78508, 79536, 82488, 88935, 90000, 90056, 95000, 90000, 91633, 91660, 98150, 98964, 100000, 98988, 100000, 108923, 105000, 103117]
19+
plt.plot(ages_x, dev_y, color='#444444', linestyle='--', label='All Devs')
20+
21+
plt.xlabel('Ages')
22+
plt.ylabel('Median Salary (USD)')
23+
plt.title('Median Salary (USD) by Age')
24+
25+
plt.legend()
26+
27+
plt.tight_layout()
28+
29+
plt.savefig('plot.png')
30+
31+
plt.show()

Diff for: Python/Matplotlib/01-Introduction/plot.png

71.6 KB
Loading

Diff for: Python/Matplotlib/01-Introduction/snippets.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
# Median Developer Salaries by Age
3+
dev_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]
4+
5+
dev_y = [38496, 42000, 46752, 49320, 53200,
6+
56000, 62316, 64928, 67317, 68748, 73752]
7+
8+
9+
# Median Python Developer Salaries by Age
10+
py_dev_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]
11+
py_dev_y = [45372, 48876, 53850, 57287, 63016,
12+
65998, 70003, 70000, 71496, 75370, 83640]
13+
14+
15+
# Median JavaScript Developer Salaries by Age
16+
js_dev_y = [37810, 43515, 46823, 49293, 53437,
17+
56373, 62375, 66674, 68745, 68746, 74583]
18+
19+
20+
# Ages 18 to 55
21+
ages_x = [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
22+
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55]
23+
24+
py_dev_y = [20046, 17100, 20000, 24744, 30500, 37732, 41247, 45372, 48876, 53850, 57287, 63016, 65998, 70003, 70000, 71496, 75370, 83640, 84666,
25+
84392, 78254, 85000, 87038, 91991, 100000, 94796, 97962, 93302, 99240, 102736, 112285, 100771, 104708, 108423, 101407, 112542, 122870, 120000]
26+
27+
js_dev_y = [16446, 16791, 18942, 21780, 25704, 29000, 34372, 37810, 43515, 46823, 49293, 53437, 56373, 62375, 66674, 68745, 68746, 74583, 79000,
28+
78508, 79996, 80403, 83820, 88833, 91660, 87892, 96243, 90000, 99313, 91660, 102264, 100000, 100000, 91660, 99240, 108000, 105000, 104000]
29+
30+
dev_y = [17784, 16500, 18012, 20628, 25206, 30252, 34368, 38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752, 77232,
31+
78000, 78508, 79536, 82488, 88935, 90000, 90056, 95000, 90000, 91633, 91660, 98150, 98964, 100000, 98988, 100000, 108923, 105000, 103117]

0 commit comments

Comments
 (0)