forked from CoreyMSchafer/code_snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinished_code.py
More file actions
33 lines (23 loc) · 855 Bytes
/
Copy pathfinished_code.py
File metadata and controls
33 lines (23 loc) · 855 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
28
29
30
31
32
33
import pandas as pd
from matplotlib import pyplot as plt
data = pd.read_csv('data.csv')
ages = data['Age']
dev_salaries = data['All_Devs']
py_salaries = data['Python']
js_salaries = data['JavaScript']
plt.plot(ages, dev_salaries, color='#444444',
linestyle='--', label='All Devs')
plt.plot(ages, py_salaries, label='Python')
overall_median = 57287
plt.fill_between(ages, py_salaries, dev_salaries,
where=(py_salaries > dev_salaries),
interpolate=True, alpha=0.25, label='Above Avg')
plt.fill_between(ages, py_salaries, dev_salaries,
where=(py_salaries <= dev_salaries),
interpolate=True, color='red', alpha=0.25, label='Below Avg')
plt.legend()
plt.title('Median Salary (USD) by Age')
plt.xlabel('Ages')
plt.ylabel('Median Salary (USD)')
plt.tight_layout()
plt.show()