Skip to content

Commit ecffe2e

Browse files
committed
matplotlib demo plot
0 parents  commit ecffe2e

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
venv

Introduction/demo.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -*- coding: utf-8 -*-
2+
# @Author: manjusv
3+
# @Date: 2019-07-09 12:17:17
4+
# @Last Modified by: manjusv
5+
# @Last Modified time: 2019-07-09 12:35:34
6+
7+
from matplotlib import pyplot as plt
8+
9+
plt.style.use('fivethirtyeight')
10+
11+
ages_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]
12+
13+
# Median Developer Salaries by Age
14+
dev_y = [38496, 42000, 46752, 49320, 53200,
15+
56000, 62316, 64928, 67317, 68748, 73752]
16+
plt.plot(ages_x, dev_y, color='k', linestyle='--', marker='o', label='All Devs')
17+
18+
# Median Python Developer Salaries by Age
19+
py_dev_y = [45372, 48876, 53850, 57287, 63016,
20+
65998, 70003, 70000, 71496, 75370, 83640]
21+
plt.plot(ages_x, py_dev_y, color='b', linestyle='-', marker='o', label='Python')
22+
23+
# Median JavaScript Developer Salaries by Age
24+
js_dev_y = [37810, 43515, 46823, 49293, 53437,
25+
56373, 62375, 66674, 68745, 68746, 74583]
26+
plt.plot(ages_x, js_dev_y, label='JavaScript')
27+
28+
29+
plt.title("Median Salary (USD) by age")
30+
plt.xlabel("Ages")
31+
plt.ylabel("median Salary (USD)")
32+
plt.legend()
33+
plt.tight_layout()
34+
plt.savefig('plot.png')
35+
plt.show()

Introduction/plot.png

53.8 KB
Loading

0 commit comments

Comments
 (0)