-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPython code
22 lines (18 loc) · 967 Bytes
/
Python code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import matplotlib.pyplot as plt
import seaborn as sns
fig, (ax0, ax1) = plt.subplots(nrows = 1, ncols = 2, figsize = (15,8))
#creating the two plots to display avg parts per year and avg sets per year
sns.lineplot(x='year', y='avg_parts_per_year', data=df_ppy, ax=ax0, color='blue')
sns.lineplot(x='year', y='sets', data = df_sets, ax = ax1, color='blue')
#creating a horizontal line to denote the average amount from 1950-2017
ax0.axhline(y= 28698, label='Avg parts', linestyle='--', color='black')
ax1.axhline(y= 176.9, label='Avg sets', linestyle='--', color='black')
#customizing plots with legends and labels
#limiting x axis from 1949-2018 to better display trends
ax0.legend()
ax1.legend()
ax0.set(xlabel = 'Year', ylabel = 'Parts Produced', xlim=(1949,2018))
ax0.set_title('Average Number of Parts Produced per Year')
ax1.set(xlabel = 'Year', ylabel = 'Sets Produced', xlim=(1949,2018))
ax1.set_title('Sets Produced per Year')
plt.show()